[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
workqueues and serialization
Hi All,
I am using workqueues in my module.
Since work_struct or delayed_work can be context switch, they can
sleep and are safe.
So does this means i need to serialize my work handler function
between work events manually?
e.g
static void work_handler(struct work_struct *work)
{
/*Do something here*/
unsigned long delay = jiffies + 20;
INIT_DELAYED_WORK(&mydelayedwork, work_handler);
schedule_delayed_work(mydelaydwork, delay);
}
static int my_init(void)
{
/*do something*/
unsigned long delay = jiffies + 20;
INIT_DELAYED_WORK(&mydelayedwork, work_handler);
schedule_delayed_work(mydelaydwork, delay)
return 0;
}
This code certainly looks like needing serialization as it is quite
possible for different work events to wake up at differenent times.Am
i right?
Please note i m using 2.6.20.1 kernel. And workqueues API seem to be a
little different than what provided in Greg's and Robert's Book.
TIA
~psr
--
play the game
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ