public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* workqueue and pending
@ 2004-05-03 11:39 Mikkel Christiansen
  2004-05-03 23:27 ` Andrew Morton
  0 siblings, 1 reply; 8+ messages in thread
From: Mikkel Christiansen @ 2004-05-03 11:39 UTC (permalink / raw)
  To: linux-kernel

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



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-05-04 13:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-03 11:39 workqueue and pending Mikkel Christiansen
2004-05-03 23:27 ` Andrew Morton
2004-05-04  2:51   ` Benjamin Herrenschmidt
2004-05-04  3:16     ` Andrew Morton
2004-05-04  3:55       ` Benjamin Herrenschmidt
2004-05-04  4:15         ` Andrew Morton
2004-05-04  4:41           ` Benjamin Herrenschmidt
2004-05-04 13:36       ` Mikkel Christiansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox