1 /* Public domain. */ 2 3 #ifndef _LINUX_WAIT_BIT_H 4 #define _LINUX_WAIT_BIT_H 5 6 #include <linux/wait.h> 7 8 int wait_on_bit(unsigned long *, int, unsigned); 9 int wait_on_bit_timeout(unsigned long *, int, unsigned, int); 10 void wake_up_bit(void *, int); 11 void clear_and_wake_up_bit(int, void *); 12 13 wait_queue_head_t *bit_waitqueue(void *, int); 14 wait_queue_head_t *__var_waitqueue(void *); 15 16 extern wait_queue_head_t var_waitq; 17 18 static inline void 19 wake_up_var(void *var) 20 { 21 wake_up(&var_waitq); 22 } 23 24 #define wait_var_event(var, condition) \ 25 wait_event(var_waitq, (condition)) 26 27 #define wait_var_event_interruptible(var, condition) \ 28 wait_event_interruptible(var_waitq, condition) 29 30 #define wait_var_event_killable(var, condition) \ 31 wait_event_killable(var_waitq, (condition)) 32 33 #define ___wait_var_event(var, condition, state, ex, ret, fn) \ 34 ({ \ 35 long __ret = ret ; \ 36 if (state & TASK_INTERRUPTIBLE) \ 37 __ret = wait_var_event_interruptible((var), (condition)); \ 38 else \ 39 wait_var_event((var), (condition)); \ 40 __ret; \ 41 }) 42 43 #endif 44