A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/dotnet/api/system.threading.lock.enterscope below:

Lock.EnterScope Method (System.Threading) | Microsoft Learn

Lock.EnterScope Method Definition

Enters the lock, waiting if necessary until the lock can be entered.

public:
 System::Threading::Lock::Scope EnterScope();
public System.Threading.Lock.Scope EnterScope();
member this.EnterScope : unit -> System.Threading.Lock.Scope
Public Function EnterScope () As Lock.Scope
Returns

A Lock.Scope that can be disposed to exit the lock.

Exceptions

The lock has reached the limit of repeated entries by the current thread. The limit is implementation-defined and is intended to be high enough that it would not be reached in normal situations.

Remarks

If the lock can't be entered immediately, the method waits until the lock can be entered. If the lock is already held by the current thread, the lock is entered again. To fully exit the lock and allow other threads to enter the lock, the current thread should dispose the returned Lock.Scope to exit the lock as many times as it has entered the lock.

This method is intended to be used with a language construct that automatically disposes the Lock.Scope, such as the C# using keyword.

For more information, see the Remarks for Lock.

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, see our contributor guide.

Additional resources In this article


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.3