lkml.org 
[lkml]   [2004]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectworkqueue 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/

\
 
 \ /
  Last update: 2005-03-22 14:02    [W:0.092 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site