mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
lock: add futex_inc_and_wake and futex_wait_while_lt (v2)
v2: fix descriptions Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
0fc129a121
commit
07a8647466
@@ -70,6 +70,13 @@ static inline void futex_dec_and_wake(futex_t *f)
|
||||
BUG_ON(sys_futex(&f->raw.counter, FUTEX_WAKE, INT_MAX, NULL, NULL, 0) < 0);
|
||||
}
|
||||
|
||||
/* Increment futex @f value and wake up all waiters */
|
||||
static inline void futex_inc_and_wake(futex_t *f)
|
||||
{
|
||||
atomic_inc(&f->raw);
|
||||
BUG_ON(sys_futex(&f->raw.counter, FUTEX_WAKE, INT_MAX, NULL, NULL, 0) < 0);
|
||||
}
|
||||
|
||||
/* Plain increment futex @f value */
|
||||
static inline void futex_inc(futex_t *f) { atomic_inc(&f->raw); }
|
||||
|
||||
@@ -84,6 +91,10 @@ static inline void futex_wait_until(futex_t *f, u32 v)
|
||||
static inline void futex_wait_while_gt(futex_t *f, u32 v)
|
||||
{ futex_wait_if_cond(f, v, <=); }
|
||||
|
||||
/* Wait while futex @f value is less than @v */
|
||||
static inline void futex_wait_while_lt(futex_t *f, u32 v)
|
||||
{ futex_wait_if_cond(f, v, >=); }
|
||||
|
||||
/* Wait while futex @f value is @v */
|
||||
static inline void futex_wait_while(futex_t *f, u32 v)
|
||||
{
|
||||
|
Reference in New Issue
Block a user