All of lore.kernel.org
 help / color / mirror / Atom feed
* sleep for ever ?
@ 2006-09-06 14:11 ` Bo Yang
  2006-09-07 10:01   ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Bo Yang @ 2006-09-06 14:11 UTC (permalink / raw)
  To: linux-kernel

Hi ,
    Take a look at following code :

DECLARE_WAITQUEUE(wait, current);

add_wait_queue(q, &wait);
while (!condition) {
        /* if there is an interrupt here , and the interrupt
           is just the one the sleeping process wait
           for , is this process sleep for the interrupt
           for ever ?*/
        set_current_state(TASK_INTERRUPTIBLE);
        if (signal_pending(current))
                /* handle signal */
        schedule();
}
set_current_state(TASK_RUNNING);
remove_wait_queue(q, &wait);

Suppose the process just want to sleep for an hardware
event , but before the set_current_state() call , the event
come , is the process sleep for ever ?


^ permalink raw reply	[flat|nested] 4+ messages in thread
* sleep for ever ?
@ 2006-09-06 14:09 ` 杨波
  0 siblings, 0 replies; 4+ messages in thread
From: 杨波 @ 2006-09-06 14:09 UTC (permalink / raw)
  To: linux-kernel

Hi ,
    Take a look at following code :

DECLARE_WAITQUEUE(wait, current);

add_wait_queue(q, &wait);
while (!condition) {
        /* if there is an interrupt here , and the interrupt
           is just the one the sleeping process wait
           for , is this process sleep for the interrupt
           for ever ?*/
        set_current_state(TASK_INTERRUPTIBLE);
        if (signal_pending(current))
                /* handle signal */
        schedule();
}
set_current_state(TASK_RUNNING);
remove_wait_queue(q, &wait);

Suppose the process just want to sleep for an hardware
event , but before the set_current_state() call , the event
come , is the process sleep for ever ?


^ permalink raw reply	[flat|nested] 4+ messages in thread
* sleep for ever ?
@ 2006-09-06 14:07 ` 杨波
  0 siblings, 0 replies; 4+ messages in thread
From: 杨波 @ 2006-09-06 14:07 UTC (permalink / raw)
  To: linux-kernel

Hi ,
    Take a look at following code :

DECLARE_WAITQUEUE(wait, current);

add_wait_queue(q, &wait);
while (!condition) {
        /* if there is an interrupt here , and the interrupt
           is just the one the sleeping process wait
           for , is this process sleep for the interrupt
           for ever ?*/
        set_current_state(TASK_INTERRUPTIBLE);
        if (signal_pending(current))
                /* handle signal */
        schedule();
}
set_current_state(TASK_RUNNING);
remove_wait_queue(q, &wait);

Suppose the process just want to sleep for an hardware
event , but before the set_current_state() call , the event
come , is the process sleep for ever ?


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-09-07 10:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-06 14:11 sleep for ever ? Bo Yang
2006-09-06 14:11 ` Bo Yang
2006-09-07 10:01   ` Tejun Heo
  -- strict thread matches above, loose matches on Subject: below --
2006-09-06 14:09 杨波
2006-09-06 14:09 ` 杨波
2006-09-06 14:07 杨波
2006-09-06 14:07 ` 杨波

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.