libcoro  1.0
Coroutine support library for C++20
Public Member Functions | List of all members
coro::semaphore Class Reference

Implements semaphore for coroutines. More...

#include <semaphore.h>

Public Member Functions

 semaphore ()=default
 construct semaphore with counter set to zero More...
 
coro::future< void > acquire ()
 acquire the semaphore More...
 
coro::future< void > operator co_await ()
 Returns awaiter, so coroutine can co_await on it. More...
 
coro::promise< void >::notify release ()
 Release the semaphore. More...
 
long get ()
 Retrieve counter. More...
 
bool try_acquire ()
 Try acquire the semaphore. More...
 

Detailed Description

Implements semaphore for coroutines.

Note
use coro::mutex if you need mutex behaviour, as the coro::mutex has better performance

Definition at line 14 of file semaphore.h.


The documentation for this class was generated from the following file: