Export (0) Print
Expand All

Monitor.PulseAll Method

Notifies all waiting threads of a change in the object's state.

Namespace:  System.Threading
Assemblies:   System.Threading (in System.Threading.dll)
  mscorlib (in mscorlib.dll)

public static void PulseAll(
	Object obj
)

Parameters

obj
Type: System.Object

The object that sends the pulse.

ExceptionCondition
ArgumentNullException

The obj parameter is null.

SynchronizationLockException

The calling thread does not own the lock for the specified object.

The thread that currently owns the lock on the specified object invokes this method to signal all threads waiting to acquire the lock on the object. After the signal is sent, the waiting threads are moved to the ready queue. When the thread that invoked PulseAll releases the lock, the next thread in the ready queue acquires the lock.

Note that a synchronized object holds several references, including a reference to the thread that currently holds the lock, a reference to the ready queue, which contains the threads that are ready to obtain the lock, and a reference to the waiting queue, which contains the threads that are waiting for notification of a change in the object's state.

The Pulse, PulseAll, and Wait methods must be invoked from within a synchronized block of code.

The remarks for the Pulse method explain what happens if Pulse is called when no threads are waiting.

To signal a single thread, use the Pulse method.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
Show:
© 2015 Microsoft