Re: Scheduling inside bottom-half

Jens Axboe (axboe@image.dk)
Thu, 30 Sep 1999 23:05:47 +0200


On Thu, Sep 30 1999, Linux Lists wrote:
> I don't feel comfortable with busy waiting ... Where can I find more info
> about how to use kernel timers ??

Busy waiting _is_ bad. Timers are easy :

struct timer_list my_timer;
...
my_timer.expires = jiffes + HZ;
my_timer.function = my_timer_handler;
my_timer.data = data_pointer_whatever
add_timer(&my_timer);

void my_timer_handler(unsigned long data)
{
printk("wuhu\n");
}

my_timer_handler receives the .data as an argument, so you can
use the same handler for multiple timers. Remember to del_timer()
also!

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