KestrunLockRegistry.GetOrCreate method

Gets an existing semaphore for the specified key, or creates a new one with an initial and maximum count of 1.

public static SemaphoreSlim GetOrCreate(string key)
parameter description
key The resource key.

Return Value

A SemaphoreSlim that can be awaited to serialize access to the resource identified by key.

Exceptions

exception condition
ArgumentException Thrown when key is empty, or whitespace.
ArgumentNullException Thrown when key is null.

See Also