Partager via


ReentrantSemaphore Class

Definition

A JoinableTaskFactory-aware semaphore that allows reentrancy without consuming another slot in the semaphore.

public ref class ReentrantSemaphore abstract : IDisposable
[System.Diagnostics.DebuggerDisplay("CurrentCount = {CurrentCount}")]
public abstract class ReentrantSemaphore : IDisposable
[<System.Diagnostics.DebuggerDisplay("CurrentCount = {CurrentCount}")>]
type ReentrantSemaphore = class
    interface IDisposable
Public MustInherit Class ReentrantSemaphore
Implements IDisposable
Inheritance
ReentrantSemaphore
Attributes
Implements

Properties

CurrentCount

Gets the number of openings that remain in the semaphore.

Methods

Create(Int32, JoinableTaskContext, ReentrantSemaphore+ReentrancyMode)

Initializes a new instance of the ReentrantSemaphore class.

Dispose()

Faults all pending semaphore waiters with ObjectDisposedException and rejects all subsequent attempts to enter the semaphore with the same exception.

Dispose(Boolean)

Disposes managed and unmanaged resources held by this instance.

ExecuteAsync(Func<Task>, CancellationToken)

Executes a given operation within the semaphore.

ExecuteAsync<T>(Func<ValueTask<T>>, CancellationToken)

Executes a given operation within the semaphore.

SuppressRelevance()

Conceals evidence that the caller has entered this ReentrantSemaphore till its result is disposed.

ThrowIfFaulted()

Throws an exception if this instance has been faulted.

Applies to