You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to have an async semaphore implementation for maitake.
A semaphore is a useful synchronization type for things like rate-limiting async tasks. It could also be used as a lower-level primitive to implement things like read-write locks1 and channels2.
We can probably do something very similar to the implementation I wrote for Tokio in tokio-rs/tokio#2325, although it should be possible to simplify some code that was only necessary to maintain Tokio's API surface.
Footnotes
a rwlock can be modeled by a semaphore with n permits (where n is the maximum number of concurrent readers); each reader must acquire a single permit, while a writer must acquire n permits). ↩
a bounded MPSC channel of capacity n can be implemented using a semaphore with n permits, where each producer must acquire a single permit to write, and every time a message is consumed, the reader releases a permit to the writers. ↩
The text was updated successfully, but these errors were encountered:
It would be nice to have an async semaphore implementation for
maitake
.A semaphore is a useful synchronization type for things like rate-limiting async tasks. It could also be used as a lower-level primitive to implement things like read-write locks1 and channels2.
We can probably do something very similar to the implementation I wrote for Tokio in tokio-rs/tokio#2325, although it should be possible to simplify some code that was only necessary to maintain Tokio's API surface.
Footnotes
a rwlock can be modeled by a semaphore with n permits (where n is the maximum number of concurrent readers); each reader must acquire a single permit, while a writer must acquire n permits). ↩
a bounded MPSC channel of capacity n can be implemented using a semaphore with n permits, where each producer must acquire a single permit to write, and every time a message is consumed, the reader releases a permit to the writers. ↩
The text was updated successfully, but these errors were encountered: