6 #ifndef ABTD_FUTEX_H_INCLUDED
7 #define ABTD_FUTEX_H_INCLUDED
9 #ifndef ABT_CONFIG_ACTIVE_WAIT_POLICY
13 typedef struct ABTD_futex_multiple ABTD_futex_multiple;
16 static inline void ABTD_futex_multiple_init(ABTD_futex_multiple *p_futex);
21 void ABTD_futex_wait_and_unlock(ABTD_futex_multiple *p_futex,
22 ABTD_spinlock *p_lock);
27 void ABTD_futex_timedwait_and_unlock(ABTD_futex_multiple *p_futex,
28 ABTD_spinlock *p_lock,
29 double wait_time_sec);
33 void ABTD_futex_broadcast(ABTD_futex_multiple *p_futex);
37 typedef struct ABTD_futex_single ABTD_futex_single;
40 static inline void ABTD_futex_single_init(ABTD_futex_single *p_futex);
47 void ABTD_futex_suspend(ABTD_futex_single *p_futex);
51 void ABTD_futex_resume(ABTD_futex_single *p_futex);
53 #ifdef ABT_CONFIG_USE_LINUX_FUTEX
55 struct ABTD_futex_multiple {
59 static inline void ABTD_futex_multiple_init(ABTD_futex_multiple *p_futex)
61 ABTD_atomic_relaxed_store_int(&p_futex->val, 0);
64 struct ABTD_futex_single {
68 static inline void ABTD_futex_single_init(ABTD_futex_single *p_futex)
70 ABTD_atomic_relaxed_store_int(&p_futex->val, 0);
75 struct ABTD_futex_multiple {
79 static inline void ABTD_futex_multiple_init(ABTD_futex_multiple *p_futex)
81 p_futex->p_next = NULL;
84 struct ABTD_futex_single {
85 ABTD_atomic_ptr p_sync_obj;
88 static inline void ABTD_futex_single_init(ABTD_futex_single *p_futex)
90 ABTD_atomic_relaxed_store_ptr(&p_futex->p_sync_obj, NULL);