[lkml]   [2004]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectworkqueue and pending

We're trying to use the workqueue interface for scheduling a delayed
gargage collector.
Since we only need a single delayed thread we used the DECLEARE_WORK macro.

The problem is that once we call cancel_delayed_work we can't schedule
work again.

Having looked at the code i noticed that cancel_delayed_work only
deletes the timer but
doesn't set clear the "pending" bit, thus any call to
schedule_delayed_work is ignorred.


static DECLARE_WORK(tft, timeoutfun, NULL)
schedule_delayed_work(&tft, 1*HZ);

<do some work>

tft.pending = 0; / / if we dont clear pending no work can be scheduled
schedule_delayed_work(&tft, 1*HZ);
return 0;

End example

Setting tft.pending is a rather ugly solution - shouldn't it be cleared by
cancel_delayed_work?, or are we using the interface in the wrong way?


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 14:02    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean