Files | |
file | condvar.h |
file | futex.h |
file | mutex.h |
file | rwlock.h |
file | semaphore.h |
file | spinlock.h |
file | synch.h |
file | waitq.h |
file | condvar.c |
Condition variables. | |
file | futex.c |
Kernel backend for futexes. | |
file | mutex.c |
Mutexes. | |
file | rwlock.c |
Reader/Writer locks. | |
file | semaphore.c |
Semaphores. | |
file | spinlock.c |
Spinlocks. | |
file | waitq.c |
Wait queue. | |
Data Structures | |
struct | condvar |
struct | futex |
struct | mutex |
struct | rwlock |
struct | semaphore |
struct | spinlock |
struct | waitq |
Defines | |
#define | condvar_wait(cv, mtx) _condvar_wait_timeout((cv),(mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE) |
#define | condvar_wait_timeout(cv, mtx, usec) _condvar_wait_timeout((cv),(mtx),(usec),SYNCH_FLAGS_NONE) |
#define | mutex_lock(mtx) _mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE) |
#define | mutex_trylock(mtx) _mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING) |
#define | mutex_lock_timeout(mtx, usec) _mutex_lock_timeout((mtx),(usec),SYNCH_FLAGS_NON_BLOCKING) |
#define | mutex_lock_active(mtx) while (mutex_trylock((mtx)) != ESYNCH_OK_ATOMIC) |
#define | rwlock_write_lock(rwl) _rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE) |
#define | rwlock_read_lock(rwl) _rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE) |
#define | rwlock_write_trylock(rwl) _rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING) |
#define | rwlock_read_trylock(rwl) _rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING) |
#define | rwlock_write_lock_timeout(rwl, usec) _rwlock_write_lock_timeout((rwl),(usec),SYNCH_FLAGS_NONE) |
#define | rwlock_read_lock_timeout(rwl, usec) _rwlock_read_lock_timeout((rwl),(usec),SYNCH_FLAGS_NONE) |
#define | semaphore_down(s) _semaphore_down_timeout((s),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE) |
#define | semaphore_trydown(s) _semaphore_down_timeout((s),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING) |
#define | semaphore_down_timeout(s, usec) _semaphore_down_timeout((s),(usec),SYNCH_FLAGS_NONE) |
#define | SPINLOCK_DECLARE(slname) spinlock_t slname |
#define | SPINLOCK_INITIALIZE(slname) |
#define | spinlock_lock(x) atomic_lock_arch(&(x)->val) |
#define | SYNCH_NO_TIMEOUT 0 |
#define | SYNCH_FLAGS_NONE 0 |
#define | SYNCH_FLAGS_NON_BLOCKING (1<<0) |
#define | SYNCH_FLAGS_INTERRUPTIBLE (1<<1) |
#define | ESYNCH_WOULD_BLOCK 1 |
#define | ESYNCH_TIMEOUT 2 |
#define | ESYNCH_INTERRUPTED 4 |
#define | ESYNCH_OK_ATOMIC 8 |
#define | ESYNCH_OK_BLOCKED 16 |
#define | SYNCH_FAILED(rc) ((rc) & (ESYNCH_WOULD_BLOCK | ESYNCH_TIMEOUT | ESYNCH_INTERRUPTED)) |
#define | SYNCH_OK(rc) ((rc) & (ESYNCH_OK_ATOMIC | ESYNCH_OK_BLOCKED)) |
#define | WAKEUP_FIRST 0 |
#define | WAKEUP_ALL 1 |
#define | waitq_sleep(wq) waitq_sleep_timeout((wq),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE) |
#define | FUTEX_HT_SIZE 1024 |
#define | ALLOW_ALL 0 |
#define | ALLOW_READERS_ONLY 1 |
Enumerations | |
enum | rwlock_type { RWLOCK_NONE, RWLOCK_READER, RWLOCK_WRITER } |
Functions | |
void | condvar_initialize (condvar_t *cv) |
void | condvar_signal (condvar_t *cv) |
void | condvar_broadcast (condvar_t *cv) |
int | _condvar_wait_timeout (condvar_t *cv, mutex_t *mtx, __u32 usec, int flags) |
void | futex_init (void) |
__native | sys_futex_sleep_timeout (__address uaddr, __u32 usec, int flags) |
__native | sys_futex_wakeup (__address uaddr) |
void | futex_cleanup (void) |
void | mutex_initialize (mutex_t *mtx) |
int | _mutex_lock_timeout (mutex_t *mtx, __u32 usec, int flags) |
void | mutex_unlock (mutex_t *mtx) |
void | rwlock_initialize (rwlock_t *rwl) |
void | rwlock_read_unlock (rwlock_t *rwl) |
void | rwlock_write_unlock (rwlock_t *rwl) |
int | _rwlock_read_lock_timeout (rwlock_t *rwl, __u32 usec, int flags) |
int | _rwlock_write_lock_timeout (rwlock_t *rwl, __u32 usec, int flags) |
void | semaphore_initialize (semaphore_t *s, int val) |
int | _semaphore_down_timeout (semaphore_t *s, __u32 usec, int flags) |
void | semaphore_up (semaphore_t *s) |
void | spinlock_initialize (spinlock_t *sl, char *name) |
int | spinlock_trylock (spinlock_t *sl) |
void | spinlock_lock_debug (spinlock_t *sl) |
static void | spinlock_unlock (spinlock_t *sl) |
void | waitq_initialize (waitq_t *wq) |
int | waitq_sleep_timeout (waitq_t *wq, __u32 usec, int flags) |
ipl_t | waitq_sleep_prepare (waitq_t *wq) |
int | waitq_sleep_timeout_unsafe (waitq_t *wq, __u32 usec, int flags) |
void | waitq_sleep_finish (waitq_t *wq, int rc, ipl_t ipl) |
void | waitq_wakeup (waitq_t *wq, bool all) |
void | _waitq_wakeup_unsafe (waitq_t *wq, bool all) |
void | waitq_interrupt_sleep (thread_t *t) |
static void | futex_initialize (futex_t *futex) |
static futex_t * | futex_find (__address paddr) |
static index_t | futex_ht_hash (__native *key) |
static bool | futex_ht_compare (__native *key, count_t keys, link_t *item) |
static void | futex_ht_remove_callback (link_t *item) |
static void | let_others_in (rwlock_t *rwl, int readers_only) |
static void | release_spinlock (void *arg) |
static void | waitq_timeouted_sleep (void *data) |
Variables | |
static rwlock_t | futex_ht_lock |
static hash_table_t | futex_ht |
static hash_table_operations_t | futex_ht_ops |
|
Definition at line 71 of file rwlock.c. Referenced by rwlock_read_unlock(), and rwlock_write_unlock(). |
|
Definition at line 72 of file rwlock.c. Referenced by _rwlock_write_lock_timeout(). |
|
|
|
|
|
Sleep was interrupted. Definition at line 46 of file synch.h. Referenced by _rwlock_read_lock_timeout(), and waitq_sleep_timeout_unsafe(). |
|
Operation succeeded without sleeping. Definition at line 47 of file synch.h. Referenced by _rwlock_read_lock_timeout(), waitq_sleep_finish(), and waitq_sleep_timeout_unsafe(). |
|
Operation succeeded and did sleep. Definition at line 48 of file synch.h. Referenced by _rwlock_read_lock_timeout(), and waitq_sleep_timeout_unsafe(). |
|
Timeout occurred. Definition at line 45 of file synch.h. Referenced by _rwlock_read_lock_timeout(), ktaskgc(), and waitq_sleep_timeout_unsafe(). |
|
Could not satisfy the request without going to sleep. Definition at line 44 of file synch.h. Referenced by _rwlock_read_lock_timeout(), waitq_sleep_finish(), and waitq_sleep_timeout_unsafe(). |
|
Definition at line 57 of file futex.c. Referenced by futex_ht_hash(), and futex_init(). |
|
Definition at line 47 of file mutex.h. Referenced by _condvar_wait_timeout(), anon_page_fault(), anon_share(), as_area_create(), as_area_destroy(), as_area_resize(), as_area_share(), as_page_fault(), check_area_conflicts(), elf_page_fault(), elf_share(), find_area_and_lock(), futex_cleanup(), futex_find(), pt_lock(), ptl0_create(), sh_info_remove_reference(), and task_create(). |
|
Definition at line 53 of file mutex.h. Referenced by as_switch(), and task_destroy(). |
|
|
|
Definition at line 49 of file mutex.h. Referenced by _rwlock_read_lock_timeout(). |
|
Definition at line 58 of file rwlock.h. Referenced by futex_find(). |
|
|
|
|
|
Definition at line 56 of file rwlock.h. Referenced by futex_cleanup(), and futex_find(). |
|
|
|
|
|
Definition at line 48 of file semaphore.h. |
|
Definition at line 52 of file semaphore.h. |
|
Definition at line 50 of file semaphore.h. |
|
Definition at line 56 of file spinlock.h. |
|
Value: spinlock_t slname = { \ .val = { 0 } \ } Definition at line 69 of file spinlock.h. |
|
|
Definition at line 50 of file synch.h. Referenced by _rwlock_read_lock_timeout(), _rwlock_write_lock_timeout(), and ipc_wait_for_call(). |
|
Interruptible operation. Definition at line 42 of file synch.h. Referenced by sys_futex_sleep_timeout(), sys_ipc_wait_for_call(), and waitq_sleep_timeout_unsafe(). |
|
Non-blocking operation request. Definition at line 41 of file synch.h. Referenced by thread_usleep(), and waitq_sleep_timeout_unsafe(). |
|
No flags specified. Definition at line 40 of file synch.h. Referenced by ipc_call_sync(), and ktaskgc(). |
|
Request with no timeout. Definition at line 38 of file synch.h. Referenced by ipc_call_sync(). |
|
|
|
Definition at line 60 of file waitq.h. Referenced by _getc(). |
|
Definition at line 45 of file waitq.h. Referenced by condvar_broadcast(). |
|
Definition at line 44 of file waitq.h. Referenced by chardev_push_character(), condvar_signal(), let_others_in(), main_ap_separated_stack(), semaphore_up(), and sys_futex_wakeup(). |
|
|
|
Wait for the condition becoming true.
Definition at line 90 of file condvar.c. References waitq::missed_wakeups, mutex_lock, mutex_unlock(), waitq_sleep_finish(), waitq_sleep_prepare(), waitq_sleep_timeout_unsafe(), and condvar::wq. Here is the call graph for this function: ![]() |
|
Acquire mutex Acquire mutex. Timeout mode and non-blocking mode can be requested.
Definition at line 67 of file mutex.c. References _semaphore_down_timeout(), and mutex::sem. Referenced by _rwlock_read_lock_timeout(), and _rwlock_write_lock_timeout(). Here is the call graph for this function: ![]() |
|
Acquire reader/writer lock for writing Acquire reader/writer lock for writing. Timeout and willingness to block may be specified.
Definition at line 157 of file rwlock.c. References _mutex_lock_timeout(), ESYNCH_INTERRUPTED, ESYNCH_OK_ATOMIC, ESYNCH_OK_BLOCKED, ESYNCH_TIMEOUT, ESYNCH_WOULD_BLOCK, rwlock::exclusive, waitq::head, interrupts_disable(), interrupts_restore(), list_empty(), mutex_trylock, NULL, panic, rwlock::readers_in, release_spinlock(), RWLOCK_READER, mutex::sem, spinlock_lock, spinlock_unlock(), SYNCH_FAILED, THREAD, thread_register_call_me(), and semaphore::wq. Here is the call graph for this function: ![]() |
|
Acquire reader/writer lock for reading Acquire reader/writer lock for reading. Timeout and willingness to block may be specified.
Definition at line 103 of file rwlock.c. References _mutex_lock_timeout(), ALLOW_READERS_ONLY, rwlock::exclusive, interrupts_disable(), interrupts_restore(), let_others_in(), rwlock::readers_in, RWLOCK_WRITER, spinlock_lock, spinlock_unlock(), SYNCH_FAILED, and THREAD. Here is the call graph for this function: ![]() |
|
Semaphore down Semaphore down. Conditional mode and mode with timeout can be requested.
Definition at line 81 of file semaphore.c. References waitq_sleep_timeout(), and semaphore::wq. Referenced by _mutex_lock_timeout(). Here is the call graph for this function: ![]() |
|
Internal SMP- and IRQ-unsafe version of waitq_wakeup() This is the internal SMP- and IRQ-unsafe version of waitq_wakeup(). It assumes wq->lock is already locked and interrupts are already disabled.
Definition at line 409 of file waitq.c. References waitq::head, list_empty(), list_get_instance, list_remove(), waitq::missed_wakeups, link::next, NULL, thread::sleep_queue, thread::sleep_timeout, spinlock_lock, spinlock_unlock(), thread_ready(), thread::timeout_pending, timeout_unregister(), and thread::wq_link. Referenced by let_others_in(), scheduler_separated_stack(), and waitq_wakeup(). Here is the call graph for this function: ![]() |
|
Signal the condition has become true to all waiting threads by waking them up.
Definition at line 71 of file condvar.c. References waitq_wakeup(), WAKEUP_ALL, and condvar::wq. Here is the call graph for this function: ![]() |
|
Initialize condition variable.
Definition at line 49 of file condvar.c. References waitq_initialize(), and condvar::wq. Here is the call graph for this function: ![]() |
|
Signal the condition has become true to the first waiting thread by waking it up.
Definition at line 60 of file condvar.c. References waitq_wakeup(), WAKEUP_FIRST, and condvar::wq. Here is the call graph for this function: ![]() |
|
Remove references from futexes known to the current task. Definition at line 312 of file futex.c. References futex_ht, futex_ht_lock, hash_table_remove(), btree_node::key, btree_node::keys, list_get_instance, mutex_lock, link::next, rwlock_write_lock, TASK, and btree_node::value. Referenced by ktaskclnp(). Here is the call graph for this function: ![]() |
|
Find kernel address of the futex structure corresponding to paddr. If the structure does not exist already, a new one is created.
Definition at line 185 of file futex.c. References btree_insert(), btree_search(), futex_ht, futex_ht_lock, futex_initialize(), hash_table_find(), hash_table_get_instance, hash_table_insert(), futex::ht_link, malloc(), mutex_lock, mutex_unlock(), NULL, futex::paddr, futex::refcount, rwlock_read_lock, rwlock_read_unlock(), rwlock_write_lock, rwlock_write_unlock(), and TASK. Referenced by sys_futex_sleep_timeout(), and sys_futex_wakeup(). Here is the call graph for this function: ![]() |
|
Compare futex hash table item with a key.
Definition at line 289 of file futex.c. References ASSERT, hash_table_get_instance, and futex::paddr. |
|
Compute hash index into futex hash table.
Definition at line 278 of file futex.c. References FUTEX_HT_SIZE. |
|
Callback for removal items from futex hash table.
Definition at line 303 of file futex.c. References free(), and hash_table_get_instance. Here is the call graph for this function: ![]() |
|
Initialize futex subsystem. Definition at line 84 of file futex.c. References futex_ht, futex_ht_lock, futex_ht_ops, FUTEX_HT_SIZE, hash_table_create(), and rwlock_initialize(). Referenced by main_bsp_separated_stack(). Here is the call graph for this function: ![]() |
|
Initialize kernel futex structure.
Definition at line 94 of file futex.c. References futex::ht_link, link_initialize(), futex::paddr, futex::refcount, waitq_initialize(), and futex::wq. Referenced by futex_find(). Here is the call graph for this function: ![]() |
|
Direct handoff of reader/writer lock ownership. Direct handoff of reader/writer lock ownership to waiting readers or a writer. Must be called with rwl->lock locked. Must be called with interrupts_disable()'d.
Otherwise: (timeout scenario) Let all leading readers in. Definition at line 316 of file rwlock.c. References _waitq_wakeup_unsafe(), rwlock::exclusive, waitq::head, list_empty(), list_get_instance, link::next, NULL, rwlock::readers_in, thread::rwlock_holder_type, RWLOCK_NONE, RWLOCK_READER, mutex::sem, spinlock_lock, spinlock_unlock(), WAKEUP_FIRST, and semaphore::wq. Referenced by _rwlock_write_lock_timeout(), rwlock_read_unlock(), and rwlock_write_unlock(). Here is the call graph for this function: ![]() |
|
Initialize mutex Initialize mutex.
Definition at line 48 of file mutex.c. References mutex::sem, and semaphore_initialize(). Referenced by as_area_create(), as_area_share(), as_create(), rwlock_initialize(), and task_create(). Here is the call graph for this function: ![]() |
|
Release mutex Release mutex.
Definition at line 78 of file mutex.c. References mutex::sem, and semaphore_up(). Referenced by _condvar_wait_timeout(), as_area_create(), as_area_destroy(), as_area_resize(), as_area_share(), as_get_size(), as_page_fault(), as_switch(), check_area_conflicts(), futex_find(), pt_unlock(), ptl0_create(), sh_info_remove_reference(), task_create(), and task_destroy(). Here is the call graph for this function: ![]() |
|
Release spinlock callback This is a callback function invoked from the scheduler. The callback is registered in _rwlock_read_lock_timeout().
Definition at line 382 of file rwlock.c. References spinlock_unlock(). Referenced by _rwlock_read_lock_timeout(). Here is the call graph for this function: ![]() |
|
Initialize reader/writer lock Initialize reader/writer lock.
Definition at line 83 of file rwlock.c. References rwlock::exclusive, mutex_initialize(), rwlock::readers_in, and spinlock_initialize(). Referenced by futex_init(). Here is the call graph for this function: ![]() |
|
Release reader/writer lock held by reader Release reader/writer lock held by reader. Handoff reader/writer lock ownership directly to a waiting writer or don't do anything if more readers poses the lock.
Definition at line 284 of file rwlock.c. References ALLOW_ALL, interrupts_disable(), interrupts_restore(), let_others_in(), rwlock::readers_in, spinlock_lock, and spinlock_unlock(). Referenced by futex_find(). Here is the call graph for this function: ![]() |
|
Release reader/writer lock held by writer Release reader/writer lock held by writer. Handoff reader/writer lock ownership directly to waiting readers or a writer.
Definition at line 263 of file rwlock.c. References ALLOW_ALL, interrupts_disable(), interrupts_restore(), let_others_in(), spinlock_lock, and spinlock_unlock(). Referenced by futex_find(). Here is the call graph for this function: ![]() |
|
Initialize semaphore Initialize semaphore.
Definition at line 52 of file semaphore.c. References interrupts_disable(), interrupts_restore(), waitq::missed_wakeups, spinlock_lock, spinlock_unlock(), waitq_initialize(), and semaphore::wq. Referenced by mutex_initialize(). Here is the call graph for this function: ![]() |
|
Semaphore up Semaphore up.
Definition at line 92 of file semaphore.c. References waitq_wakeup(), WAKEUP_FIRST, and semaphore::wq. Referenced by mutex_unlock(). Here is the call graph for this function: ![]() |
|
Initialize spinlock Initialize spinlock.
Definition at line 59 of file spinlock.c. References atomic_set(), and spinlock::val. Referenced by _slab_cache_create(), _zone_merge(), chardev_initialize(), cmd_initialize(), cpu_init(), frame_init(), ipc_answerbox_init(), ipc_irq_make_table(), ipc_phone_init(), make_magcache(), rwlock_initialize(), task_create(), thr_constructor(), timeout_init(), timeout_initialize(), waitq_initialize(), and zone_construct(). Here is the call graph for this function: ![]() |
|
|
|
Lock spinlock conditionally Lock spinlock conditionally. If the spinlock is not available at the moment, signal failure.
Definition at line 141 of file spinlock.c. References CS_ENTER_BARRIER, preemption_disable(), preemption_enable(), test_and_set(), and spinlock::val. Referenced by ipc_cleanup(), scheduler_separated_stack(), timeout_unregister(), waitq_interrupt_sleep(), and waitq_timeouted_sleep(). Here is the call graph for this function: ![]() |
|
|
Sleep in futex wait queue.
Definition at line 111 of file futex.c. References ALIGN_DOWN, AS, ENOENT, futex_find(), interrupts_disable(), interrupts_restore(), page_mapping_find(), PAGE_SIZE, page_table_lock(), page_table_unlock(), SYNCH_FLAGS_INTERRUPTIBLE, waitq_sleep_timeout(), and futex::wq. Here is the call graph for this function: ![]() |
|
Wakeup one thread waiting in futex wait queue.
Definition at line 146 of file futex.c. References ALIGN_DOWN, AS, ENOENT, futex_find(), interrupts_disable(), interrupts_restore(), page_mapping_find(), PAGE_SIZE, page_table_lock(), page_table_unlock(), waitq_wakeup(), WAKEUP_FIRST, and futex::wq. Here is the call graph for this function: ![]() |
|
Initialize wait queue Initialize wait queue.
Definition at line 66 of file waitq.c. References waitq::head, list_initialize(), waitq::missed_wakeups, and spinlock_initialize(). Referenced by chardev_initialize(), condvar_initialize(), futex_initialize(), ipc_answerbox_init(), kmp(), semaphore_initialize(), thread_create(), and thread_usleep(). Here is the call graph for this function: ![]() |
|
Interrupt sleeping thread. This routine attempts to interrupt a thread from its sleep in a waitqueue. If the thread is not found sleeping, no action is taken.
Definition at line 127 of file waitq.c. References interrupts_disable(), interrupts_restore(), list_remove(), NULL, thread::saved_context, thread::sleep_interruptible, thread::sleep_interruption_context, thread::sleep_queue, thread::sleep_timeout, spinlock_lock, spinlock_trylock(), spinlock_unlock(), thread_exists(), thread_ready(), threads_lock, thread::timeout_pending, timeout_unregister(), and thread::wq_link. Referenced by task_kill(). Here is the call graph for this function: ![]() |
|
Finish waiting in a wait queue. This function restores interrupts to the state that existed prior to the call to waitq_sleep_prepare(). If necessary, the wait queue lock is released.
Definition at line 275 of file waitq.c. References ESYNCH_OK_ATOMIC, ESYNCH_WOULD_BLOCK, interrupts_restore(), and spinlock_unlock(). Referenced by _condvar_wait_timeout(), and waitq_sleep_timeout(). Here is the call graph for this function: ![]() |
|
Prepare to sleep in a waitq. This function will return holding the lock of the wait queue and interrupts disabled.
Definition at line 237 of file waitq.c. References interrupts_disable(), interrupts_restore(), spinlock_lock, spinlock_unlock(), and THREAD. Referenced by _condvar_wait_timeout(), and waitq_sleep_timeout(). Here is the call graph for this function: ![]() |
|
Sleep until either wakeup, timeout or interruption occurs This is a sleep implementation which allows itself to time out or to be interrupted from the sleep, restoring a failover context. Sleepers are organised in a FIFO fashion in a structure called wait queue. This function is really basic in that other functions as waitq_sleep() and all the *_timeout() functions use it.
If usec is greater than zero, regardless of the value of the SYNCH_FLAGS_NON_BLOCKING bit in flags, the call will not return until either timeout, interruption or wakeup comes. If usec is zero and the SYNCH_FLAGS_NON_BLOCKING bit is not set in flags, the call will not return until wakeup or interruption comes. If usec is zero and the SYNCH_FLAGS_NON_BLOCKING bit is set in flags, the call will immediately return, reporting either success or failure.
Definition at line 217 of file waitq.c. References waitq_sleep_finish(), waitq_sleep_prepare(), and waitq_sleep_timeout_unsafe(). Referenced by _semaphore_down_timeout(), ipc_wait_for_call(), sys_futex_sleep_timeout(), thread_join_timeout(), and thread_usleep(). Here is the call graph for this function: ![]() |
|
Internal implementation of waitq_sleep_timeout(). This function implements logic of sleeping in a wait queue. This call must be preceeded by a call to waitq_sleep_prepare() and followed by a call to waitq_slee_finish().
Definition at line 300 of file waitq.c. References context_save, ESYNCH_INTERRUPTED, ESYNCH_OK_ATOMIC, ESYNCH_OK_BLOCKED, ESYNCH_TIMEOUT, ESYNCH_WOULD_BLOCK, waitq::head, list_append(), waitq::missed_wakeups, scheduler(), Sleeping, spinlock_lock, spinlock_unlock(), SYNCH_FLAGS_INTERRUPTIBLE, SYNCH_FLAGS_NON_BLOCKING, THREAD, timeout_register(), and waitq_timeouted_sleep(). Referenced by _condvar_wait_timeout(), and waitq_sleep_timeout(). Here is the call graph for this function: ![]() |
|
Handle timeout during waitq_sleep_timeout() call This routine is called when waitq_sleep_timeout() timeouts. Interrupts are disabled. It is supposed to try to remove 'its' thread from the wait queue; it can eventually fail to achieve this goal when these two events overlap. In that case it behaves just as though there was no timeout at all.
Definition at line 85 of file waitq.c. References list_remove(), NULL, thread::saved_context, thread::sleep_queue, thread::sleep_timeout_context, spinlock_lock, spinlock_trylock(), spinlock_unlock(), thread_exists(), thread_ready(), threads_lock, thread::timeout_pending, and thread::wq_link. Referenced by waitq_sleep_timeout_unsafe(). Here is the call graph for this function: ![]() |
|
Wake up first thread sleeping in a wait queue Wake up first thread sleeping in a wait queue. This is the SMP- and IRQ-safe wrapper meant for general use. Besides its 'normal' wakeup operation, it attempts to unregister possible timeout.
Definition at line 386 of file waitq.c. References _waitq_wakeup_unsafe(), interrupts_disable(), interrupts_restore(), spinlock_lock, and spinlock_unlock(). Referenced by _ipc_answer_free_call(), _ipc_call(), chardev_push_character(), condvar_broadcast(), condvar_signal(), main_ap_separated_stack(), semaphore_up(), send_call(), and sys_futex_wakeup(). Here is the call graph for this function: ![]() |
|
Futex hash table. Definition at line 74 of file futex.c. Referenced by futex_cleanup(), futex_find(), and futex_init(). |
|
Read-write lock protecting global futex hash table. It is also used to serialize access to all futex_t structures. Must be acquired before the task futex B+tree lock. Definition at line 71 of file futex.c. Referenced by futex_cleanup(), futex_find(), and futex_init(). |
|
Initial value: { .hash = futex_ht_hash, .compare = futex_ht_compare, .remove_callback = futex_ht_remove_callback } Definition at line 77 of file futex.c. Referenced by futex_init(). |