Question on the condition parameter in wait_event_interruptible()

From: Parag Sharma
Date: Wed May 26 2004 - 13:07:24 EST


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/

-
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/