template <typename Mutex>

struct MutexOps

Defined at line 25 of file ../../zircon/system/ulib/sync/include/lib/sync/internal/condition-template.h

A template implementation of a condition variable.

The algorithm is borrowed from MUSL.

The 'Condition' struct must contain the following fields:

int lock;

void* head;

void* tail;

The following struct template must be specialized for the mutex type 'Mutex'

in order to instantiate the template:

Public Methods

zx_futex_t * get_futex (Mutex * mutex)

Return a pointer to the futex that backs the |mutex|

zx_status_t lock (Mutex * mutex, int * mutex_lock_err)

Lock the |mutex|. If an error occurs while locking the mutex,

ZX_ERR_BAD_STATE must be returned. An implementation-defined

error code can be returned via |mutex_lock_err| if it's not null.

zx_status_t lock_with_waiters (Mutex * mutex, int waiters_delta, int * mutex_lock_err)

Similar to lock(), but also update the waiter information in the mutex.

If the mutex implements waiter counting, then the count must be adjusted

by |waiters_delta|. Otherwise, the mutex must be marked as potentially

having waiters.

void unlock (Mutex * mutex)

Unlock the mutex

void signal_requeue (sync_completion_t * completion, Mutex * mutex)

Requeue all of the memebrs waiting in |completion| to the futex backing |mutex|.