lkml.org 
[lkml]   [1999]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: Q: waiting for a short time and not beeing a resource hog
    On Wed, Dec 01 1999, Andreas Schuldei wrote:
    > I want to wait for a short time in a driver after I got an interrupt that data
    > arrived.
    >
    > I do not like the
    >
    > while( (jiffies-time_start) < 1 );
    >
    > since it is too long and blocks the whole cpu from doing sensible stuff.
    >
    > static void jiffy_sleep(u_int time)
    > {
    > current->state = TASK_INTERRUPTIBLE;
    > current->timeout = jiffies + time;
    > schedule();
    > }
    >
    > Is this still applicable and racecondition-save?

    Not in an interrupt context. Basically you can't sleep or
    schedule inside an interrupt handler. How long do you need
    to wait?

    --
    * Jens Axboe <axboe@image.dk>
    * Linux CD-ROM Maintainer
    * http://www.kernel.dk

    -
    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:55    [W:0.019 / U:0.176 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site