Table of Contents

Class SemaphoreUtil

Namespace
Hi.Parallels
Assembly
HiGeom.dll

Utility class for semaphore operations. Provides extension methods for SemaphoreSlim to simplify semaphore acquisition and release.

public static class SemaphoreUtil
Inheritance
SemaphoreUtil
Inherited Members

Methods

Embrace(SemaphoreSlim)

Acquires the specified semaphore.

public static IDisposable Embrace(this SemaphoreSlim semaphore)

Parameters

semaphore SemaphoreSlim

The semaphore to acquire.

Returns

IDisposable

A disposable token that releases the semaphore when disposed.

EmbraceAsync(SemaphoreSlim)

Acquires the specified semaphore asynchronously.

public static Task<IDisposable> EmbraceAsync(this SemaphoreSlim semaphore)

Parameters

semaphore SemaphoreSlim

The semaphore to acquire.

Returns

Task<IDisposable>

A task that represents the asynchronous operation. The task result contains a disposable token that releases the semaphore when disposed.