Movatterモバイル変換


[0]ホーム

URL:


Skip to main contentSkip to in-page navigation

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

Monitor.PulseAll(Object) Method

Definition

Namespace:
System.Threading
Assemblies:
mscorlib.dll, System.Threading.dll
Assemblies:
netstandard.dll, System.Threading.dll
Assembly:
System.Threading.dll
Assembly:
mscorlib.dll
Assembly:
netstandard.dll
Source:
Monitor.CoreCLR.cs
Source:
Monitor.CoreCLR.cs
Source:
Monitor.CoreCLR.cs
Source:
Monitor.CoreCLR.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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

public: static void PulseAll(System::Object ^ obj);
public static void PulseAll(object obj);
static member PulseAll : obj -> unit
Public Shared Sub PulseAll (obj As Object)

Parameters

obj
Object

The object that sends the pulse.

Exceptions

Theobj parameter isnull.

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 invokedPulseAll 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.

ThePulse,PulseAll, andWait methods must be invoked from within a synchronized block of code.

The remarks for thePulse method explain what happens ifPulse is called when no threads are waiting.

To signal a single thread, use thePulse method.

Applies to

See also

Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, seeour contributor guide.

Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?