pub struct Semaphore(Arc<Semaphore>);Expand description
An async counting semaphore that works on both smol and tokio.
§Example
use karyon_core::async_runtime::lock::Semaphore;
async {
let sem = Semaphore::new(2);
let guard = sem.acquire().await.unwrap();
// ...
drop(guard);
};
Tuple Fields§
§0: Arc<Semaphore>Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Semaphore
impl !UnwindSafe for Semaphore
impl Freeze for Semaphore
impl Send for Semaphore
impl Sync for Semaphore
impl Unpin for Semaphore
impl UnsafeUnpin for Semaphore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more