VLC 4.0.0-dev
|
Data Structures | |
struct | wait_bucket |
Macros | |
#define | WAIT_BUCKET_INIT { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } |
#define | WAIT_BUCKET_INIT_2 WAIT_BUCKET_INIT, WAIT_BUCKET_INIT |
#define | WAIT_BUCKET_INIT_4 WAIT_BUCKET_INIT_2, WAIT_BUCKET_INIT_2 |
#define | WAIT_BUCKET_INIT_8 WAIT_BUCKET_INIT_4, WAIT_BUCKET_INIT_4 |
#define | WAIT_BUCKET_INIT_16 WAIT_BUCKET_INIT_8, WAIT_BUCKET_INIT_8 |
#define | WAIT_BUCKET_INIT_32 WAIT_BUCKET_INIT_16, WAIT_BUCKET_INIT_16 |
Functions | |
static struct wait_bucket * | wait_bucket_get (atomic_uint *addr) |
static struct wait_bucket * | wait_bucket_enter (atomic_uint *addr) |
static void | wait_bucket_leave (struct wait_bucket *bucket) |
void | vlc_atomic_wait (void *addr, unsigned value) |
Waits on an address. More... | |
static int | vlc_atomic_timedwait_timespec (void *addr, unsigned value, const struct timespec *restrict ts) |
static void | vlc_timespec_adjust (clockid_t cid, struct timespec *restrict ts) |
int | vlc_atomic_timedwait (void *addr, unsigned value, vlc_tick_t deadline) |
Waits on an address with a time-out. More... | |
int | vlc_atomic_timedwait_daytime (void *addr, unsigned value, time_t deadline) |
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... | |
Variables | |
static clockid_t | vlc_clock_id = CLOCK_REALTIME |
static struct wait_bucket | wait_buckets [32] = { { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } , { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } } |
#define WAIT_BUCKET_INIT { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0 } |
#define WAIT_BUCKET_INIT_16 WAIT_BUCKET_INIT_8, WAIT_BUCKET_INIT_8 |
#define WAIT_BUCKET_INIT_2 WAIT_BUCKET_INIT, WAIT_BUCKET_INIT |
#define WAIT_BUCKET_INIT_32 WAIT_BUCKET_INIT_16, WAIT_BUCKET_INIT_16 |
#define WAIT_BUCKET_INIT_4 WAIT_BUCKET_INIT_2, WAIT_BUCKET_INIT_2 |
#define WAIT_BUCKET_INIT_8 WAIT_BUCKET_INIT_4, WAIT_BUCKET_INIT_4 |
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 wait_bucket::lock, wait_bucket::wait, wait_bucket_get(), and wait_bucket::waiters.
Referenced by vlc_atomic_notify_one().
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_atomic_notify_all().
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_atomic_timedwait_timespec(), vlc_tick_to_timespec(), and vlc_timespec_adjust().
int vlc_atomic_timedwait_daytime | ( | void * | addr, |
unsigned | value, | ||
time_t | deadline | ||
) |
References timespec::tv_sec, vlc_atomic_timedwait_timespec(), and vlc_timespec_adjust().
|
static |
References wait_bucket::lock, wait_bucket::wait, wait_bucket_enter(), and wait_bucket_leave().
Referenced by vlc_atomic_timedwait(), and vlc_atomic_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 wait_bucket::lock, wait_bucket::wait, wait_bucket_enter(), and wait_bucket_leave().
|
static |
References lldiv(), timespec::tv_nsec, timespec::tv_sec, and vlc_clock_id.
Referenced by vlc_atomic_timedwait(), and vlc_atomic_timedwait_daytime().
|
static |
References wait_bucket::lock, wait_bucket_get(), and wait_bucket::waiters.
Referenced by vlc_atomic_timedwait_timespec(), and vlc_atomic_wait().
|
static |
References ARRAY_SIZE, and wait_buckets.
Referenced by vlc_atomic_notify_all(), and wait_bucket_enter().
|
static |
References wait_bucket::lock, and wait_bucket::waiters.
Referenced by vlc_atomic_timedwait_timespec(), and vlc_atomic_wait().
|
static |
Referenced by vlc_timespec_adjust().
|
static |
Referenced by wait_bucket_get().