public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Is it possible to wait on multiple wait_queues?
@ 2004-08-23 18:12 Stuart MacDonald
  0 siblings, 0 replies; only message in thread
From: Stuart MacDonald @ 2004-08-23 18:12 UTC (permalink / raw)
  To: LKML

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)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-08-23 18:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-23 18:12 Is it possible to wait on multiple wait_queues? Stuart MacDonald

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox