Messages in this thread | | | Date | Mon, 03 May 2004 13:39:33 +0200 | From | Mikkel Christiansen <> | Subject | workqueue and pending |
| |
Hi
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.
Example:
static DECLARE_WORK(tft, timeoutfun, NULL) . . . schedule_delayed_work(&tft, 1*HZ); cancel_delayed_work(&tft);
<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?
Cheers Mikkel
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |