public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Stuart MacDonald" <stuartm@connecttech.com>
To: "LKML" <linux-kernel@vger.kernel.org>
Subject: Is it possible to wait on multiple wait_queues?
Date: Mon, 23 Aug 2004 14:12:39 -0400	[thread overview]
Message-ID: <000e01c4893c$c69c6d80$294b82ce@stuartm> (raw)

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)


                 reply	other threads:[~2004-08-23 18:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000e01c4893c$c69c6d80$294b82ce@stuartm' \
    --to=stuartm@connecttech.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox