Dispatcher.Join

Method

Visual Basic

Public Sub Join()

C#

public void Join();

Purpose

Wait for a dispatcher thread to finish.

Remarks

The calling thread blocks until after the dispatcher thread is destroyed.

Consider a program in which the main thread creates a queue and listeners, and then creates a dispatcher for that queue. After that, the main thread is inactive. However, if the main thread exits, the scope for its queue and listeners evaporates (and those objects evaporate too) so the program can no longer operate correctly. To prevent this situation, the main thread calls this method, indicating a dependency between the two threads.

See Also

Dispatcher