This documentation is archived and is not being maintained.

Monitor.PulseAll Method

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

[Visual Basic]
Public Shared Sub PulseAll( _
   ByVal obj As Object _
)
[C#]
public static void PulseAll(
 object obj
);
[C++]
public: static void PulseAll(
 Object* obj
);
[JScript]
public static function PulseAll(
   obj : Object
);

Parameters

obj
The object that sends the pulse.

Exceptions

Exception Type Condition
ArgumentNullException The obj parameter is a null reference (Nothing in Visual Basic).
SynchronizationLockException The calling thread does not own the lock for the specified object.

Remarks

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 Wait(Object, Int32) address an issue that arises when Pulse is invoked before Wait.

To signal a single thread, use the Pulse method.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Common Language Infrastructure (CLI) Standard

See Also

Monitor Class | Monitor Members | System.Threading Namespace | Thread | Threading | Monitor

Show: