std1.0.0-beta-7 SafeC docs

std :: async::sync

Struct std::AsyncSemaphore

#include <std/async/sync.h> source

struct AsyncSemaphore {
    long long permits;
    struct WaitList waiters;
    struct Spinlock lk;
}

Fields

§long long permitssource
§struct WaitList waiterssource

Methods

§static struct AsyncSemaphore new(long long permits)source · definition
§struct SemAcquire acquire(long long n)source · definition

Future: Ready once 'n' permits are taken (all at once).

§int try_acquire(long long n)source · definition

1 if taken

§void release(long long n)source · definition

return permits, wake waiters

§long long available() constsource · definition