mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Parag Sharma" <ps41@hotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Question on the condition parameter in wait_event_interruptible()
Date: Wed, 26 May 2004 10:05:32 -0800	[thread overview]
Message-ID: <BAY99-F40XF2hzgOJ8P0001d374@hotmail.com> (raw)

I looked at the kernel 2.4.21 sources and found that the 'condition' in 
calls to wait_event_interruptible() is usually a global variable. This 
global variable is updated before the wakeup is issued.
It is not clear to me how this update to the global variable is seen by the 
context that issued the wait_event_interruptible(). On certain processor 
architectures and on SMP systems, is it possible that the update is not 
reflected when the condition is tested in __wait_event_interruptible()?

If the answer to above is yes, then is it possible that there is a chance 
that a wakeup might be missed when the update & wakeup occur either before 
the call to add_wait_queue() or the call to 
set_current_state(TASK_INTERRUPTIBLE) in __wait_event_interruptible()?

Thanks,
Parag
PS: Please cc me on the reply.

#define __wait_event_interruptible(wq, condition, ret)                  \
do {                                                                    \
        wait_queue_t __wait;                                            \
        init_waitqueue_entry(&__wait, current);                         \
                                                                        \
        add_wait_queue(&wq, &__wait);                                   \
        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(&wq, &__wait);                                \
} while (0)

_________________________________________________________________
Watch LIVE baseball games on your computer with MLB.TV, included with MSN 
Premium! http://join.msn.click-url.com/go/onm00200439ave/direct/01/


                 reply	other threads:[~2004-05-26 18:05 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=BAY99-F40XF2hzgOJ8P0001d374@hotmail.com \
    --to=ps41@hotmail.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

all inboxes | Powered by JetHome®