Is it possible to wait on multiple wait_queues?

From: Stuart MacDonald
Date: Mon Aug 23 2004 - 13:16:20 EST


Is there anything wrong with the code below (which has been modified
from the __wait_event_interruptible macro)? Assuming of course that
(condition) checks for both conditions.

..Stu

#define __wait_event2_interruptible(wq1, wq2, condition, ret) \
do { \
wait_queue_t __wait1, __wait2; \
init_waitqueue_entry(&__wait1, current); \
init_waitqueue_entry(&__wait2, current); \
\
add_wait_queue(&wq1, &__wait1); \
add_wait_queue(&wq2, &__wait2); \
for (;;) { \
set_current_state(TASK_INTERRUPTIBLE); \
if (condition) \
break; \
if (!signal_pending(current)) { \
schedule(); \
continue; \
} \
ret = -ERESTARTSYS; \
break; \
} \
current->state = TASK_RUNNING; \
remove_wait_queue(&wq1, &__wait1); \
remove_wait_queue(&wq2, &__wait2); \
} while (0)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/