KestrunLockRegistry class
Provides a registry of named SemaphoreSlim instances used to synchronize access to shared resources within the current process. The same key always returns the same semaphore instance.
public static class KestrunLockRegistry
Public Members
| name | description |
|---|---|
| static Default { get; } | Gets a default semaphore instance that can be used for general synchronization needs when a specific key is not required. This is useful for simple scenarios where a single lock is sufficient to protect a critical section of code or a shared resource without the need for multiple named locks. |
| static GetOrCreate(…) | Gets an existing semaphore for the specified key, or creates a new one with an initial and maximum count of 1. |
| static TryGet(…) | Attempts to get the semaphore associated with the specified key without creating a new one if it doesn’t exist. |
See Also
- namespace Kestrun.Utilities
- KestrunLockRegistry.cs