VLC 4.0.0-dev
|
Macros | |
#define | FUTEX_WAKE_PRIVATE FUTEX_WAKE |
#define | FUTEX_WAIT_PRIVATE FUTEX_WAIT |
#define | FUTEX_WAIT_BITSET_PRIVATE FUTEX_WAIT_BITSET |
Functions | |
unsigned long | vlc_thread_id (void) |
Thread identifier. More... | |
void() | vlc_thread_set_name (const char *name) |
Set the thread name of the current thread. More... | |
static int | sys_futex (void *addr, int op, unsigned val, const struct timespec *to, void *addr2, int val3) |
static int | vlc_futex_wake (void *addr, int nr) |
static int | vlc_futex_wait (void *addr, unsigned flags, unsigned val, const struct timespec *to) |
void | vlc_atomic_notify_one (void *addr) |
Wakes up one thread on an address. More... | |
void | vlc_atomic_notify_all (void *addr) |
Wakes up all thread on an address. More... | |
void | vlc_atomic_wait (void *addr, unsigned val) |
Waits on an address. More... | |
int | vlc_atomic_timedwait (void *addr, unsigned val, vlc_tick_t deadline) |
Waits on an address with a time-out. More... | |
int | vlc_atomic_timedwait_daytime (void *addr, unsigned val, time_t deadline) |
#define FUTEX_WAIT_BITSET_PRIVATE FUTEX_WAIT_BITSET |
#define FUTEX_WAIT_PRIVATE FUTEX_WAIT |
#define FUTEX_WAKE_PRIVATE FUTEX_WAKE |
|
static |
Referenced by vlc_futex_wait(), and vlc_futex_wake().
void vlc_atomic_notify_all | ( | void * | addr | ) |
Wakes up all thread on an address.
Wakes up all threads sleeping on the specified address (if any). Any thread sleeping within a call to vlc_atomic_wait() or vlc_atomic_timedwait() with the specified address as first call parameter will be woken up.
addr | address identifying which threads to wake up |
References vlc_futex_wake().
void vlc_atomic_notify_one | ( | void * | addr | ) |
Wakes up one thread on an address.
Wakes up (at least) one of the thread sleeping on the specified address. The address must be equal to the first parameter given by at least one thread sleeping within the vlc_atomic_wait() or vlc_atomic_timedwait() functions. If no threads are found, this function does nothing.
addr | address identifying which threads may be woken up |
References vlc_futex_wake().
int vlc_atomic_timedwait | ( | void * | addr, |
unsigned | val, | ||
vlc_tick_t | deadline | ||
) |
Waits on an address with a time-out.
This function operates as vlc_atomic_wait() but provides an additional time-out. If the deadline is reached, the thread resumes and the function returns.
addr | address to check for |
val | value to match at the address |
deadline | deadline to wait until |
0 | the function was woken up before the time-out |
ETIMEDOUT | the deadline was reached |
References vlc_assert_unreachable, vlc_futex_wait(), and vlc_tick_to_timespec().
int vlc_atomic_timedwait_daytime | ( | void * | addr, |
unsigned | val, | ||
time_t | deadline | ||
) |
References timespec::tv_sec, vlc_assert_unreachable, and vlc_futex_wait().
Referenced by vlc_cond_timedwait_daytime().
void vlc_atomic_wait | ( | void * | addr, |
unsigned | val | ||
) |
Waits on an address.
Puts the calling thread to sleep if a specific unsigned 32-bits value is stored at a specified address. The thread will sleep until it is woken up by a call to vlc_atomic_notify_one() or vlc_atomic_notify_all() in another thread, or spuriously.
If the value does not match, do nothing and return immediately.
addr | address to check for |
val | value to match at the address |
References vlc_futex_wait().
|
static |
References FUTEX_WAIT_BITSET_PRIVATE, and sys_futex().
Referenced by vlc_atomic_timedwait(), vlc_atomic_timedwait_daytime(), and vlc_atomic_wait().
|
static |
References FUTEX_WAKE_PRIVATE, and sys_futex().
Referenced by vlc_atomic_notify_all(), and vlc_atomic_notify_one().