Barrelfish
|
Thread synchronisation primitives. More...
Functions | |
void | thread_cond_init (struct thread_cond *cond) |
Initialise a condition variable. More... | |
void | thread_cond_wait (struct thread_cond *cond, struct thread_mutex *mutex) |
Wait for a condition variable. More... | |
void | thread_cond_signal (struct thread_cond *cond) |
Signal a condition variable. More... | |
void | thread_cond_broadcast (struct thread_cond *cond) |
Broadcast signal a condition variable. More... | |
void | thread_mutex_init (struct thread_mutex *mutex) |
Initialise a mutex. More... | |
void | thread_mutex_lock (struct thread_mutex *mutex) |
Lock a mutex. More... | |
void | thread_mutex_lock_nested (struct thread_mutex *mutex) |
Lock a mutex. More... | |
bool | thread_mutex_trylock (struct thread_mutex *mutex) |
Try to lock a mutex. More... | |
struct thread * | thread_mutex_unlock_disabled (dispatcher_handle_t handle, struct thread_mutex *mutex) |
Unlock a mutex, while disabled. More... | |
void | thread_mutex_unlock (struct thread_mutex *mutex) |
Unlock a mutex. More... | |
Thread synchronisation primitives.
void thread_cond_broadcast | ( | struct thread_cond * | cond | ) |
Broadcast signal a condition variable.
This function signals the condition variable, and wakes up all threads waiting on it.
cond | Condition variable pointer |
void thread_cond_init | ( | struct thread_cond * | cond | ) |
Initialise a condition variable.
cond | Condition variable pointer |
void thread_cond_signal | ( | struct thread_cond * | cond | ) |
Signal a condition variable.
This function signals the condition variable, and wakes up one thread waiting on it.
cond | Condition variable pointer |
void thread_cond_wait | ( | struct thread_cond * | cond, |
struct thread_mutex * | mutex | ||
) |
Wait for a condition variable.
This function waits for the given condition variable to be signalled (through thread_cond_signal() or thread_cond_broadcast()) before returning, while atomically unlocking the mutex pointed to by 'mutex'.
cond | Condition variable pointer |
mutex | Optional pointer to mutex to unlock. |
void thread_mutex_init | ( | struct thread_mutex * | mutex | ) |
Initialise a mutex.
mutex | Mutex pointer |
void thread_mutex_lock | ( | struct thread_mutex * | mutex | ) |
Lock a mutex.
This blocks until the given mutex is unlocked, and then atomically locks it.
mutex | Mutex pointer |
void thread_mutex_lock_nested | ( | struct thread_mutex * | mutex | ) |
Lock a mutex.
This blocks until the given mutex is unlocked, and then atomically locks it.
mutex | Mutex pointer |
bool thread_mutex_trylock | ( | struct thread_mutex * | mutex | ) |
Try to lock a mutex.
If the given mutex is unlocked, this atomically locks it and returns true, otherwise it returns false immediately.
mutex | Mutex pointer |
void thread_mutex_unlock | ( | struct thread_mutex * | mutex | ) |
Unlock a mutex.
This unlocks the given mutex.
mutex | Mutex pointer |
struct thread* thread_mutex_unlock_disabled | ( | dispatcher_handle_t | handle, |
struct thread_mutex * | mutex | ||
) |
Unlock a mutex, while disabled.
This function unlocks the given mutex. It may only be called while disabled.
disp | Dispatcher pointer |
mutex | Mutex pointer |