Skip to content

AsyncSemaphore

kobi2294 edited this page Apr 22, 2019 · 1 revision

AsyncSemaphore class

The AsyncSemaphore class is quire similar to the AsyncMutex class, except that it allows a certain level of parallelism. While AsyncMutex allows only a single lock to be aquired at any specific time, the AsyncSemaphore takes a locks limit count as constructor parameter. The Lock Method will return a lock (a completed task whose result is a lock) as long as the concurrent number of locks does not exceed the locks limit. When it does, the next request for lock will return a task that will only complete when one of the busy locks is released.

Other then the locks limit, using the AsyncMutex and AsyncSemaphore is exactly the same.

Clone this wiki locally