lkml.org 
[lkml]   [1999]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: schedule_timeout() semantics/usage?
Andrea Arcangeli wrote:
>
> On Wed, 20 Oct 1999, David Hinds wrote:
>
> >Look at net/irda/*.c [..]
>
> /* Make sure nobody tries to transmit during the speed change */
> while (irda_lock((void *) &self->netdev.tbusy) == FALSE) {
> WARNING(__FUNCTION__ "(), device locked!\n");
> current->state = TASK_INTERRUPTIBLE;
> schedule_timeout(MSECS_TO_JIFFIES(10));
>
> if (n++ > 10) {
> WARNING(__FUNCTION__ "(), breaking loop!\n");
> break;
> }
> }
>
> The above looks a bug. It should be using
> __set_current_state(TASK_UNINTERRUPTIBLE).


Since there is confusion on this subject, does it seem reasonable to
provide functions to encapsulate this behavior?

inline void ksnooze_nowakeups (unsigned long timeout)
{
__set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(timeout);
}

inline void ksnooze (unsigned long timeout)
{
do {
__set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
} while (timeout);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.050 / U:1.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site