Struct semaphore_key::SemaphoreKey
source · pub struct SemaphoreKey {}
Expand description
The SemaphoreKey struct holds an implementation to be used to for the Semaphore by key functionality.
Implementations§
source§impl SemaphoreKey
impl SemaphoreKey
sourcepub async fn get_or_create_semaphore(
key: &String,
allowed_concurrent_threads: usize
) -> Arc<Semaphore>
pub async fn get_or_create_semaphore( key: &String, allowed_concurrent_threads: usize ) -> Arc<Semaphore>
Gets or creates a semaphore wrapped in an Arc by the provided key
Arguments
-
key
- The key to get an existing or create a new semaphore by -
allowed_concurrent_threads
- Used when creating a new semaphore (if an existing one is not found by key), to specify how many concurrent threads are allowed access.