lkml.org 
[lkml]   [2004]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] add unschedule_delayed_work to the workqueue API
James Bottomley <James.Bottomley@SteelEye.com> wrote:
>
> > > OK, found it in the headers, sorry .. it's not synchronous, so it can't
> > > really be used in most of the cases where we use del_timer_sync().
> >
> > cancel_delayed_work() will tell you whether it successfully cancelled the
> > timer. If it didn't, you should run flush_workqueue() to wait on the final
> > handler. The combination of the two is synchronous.
>
> Right, but it potentially does too much work for my purposes.

Are you sure?

> I want to
> cancel the work if it's cancellable or wait for it if it's already
> executing. I don't want to have to wait for all the work in the queue
> just because the timer fired and it got added to the workqueue schedule.

The probability that the handler is running when you call
cancel_delayed_work() is surely very low. And the probability that there
is more than one thing pending in the queue at that time is also low.
Multiplying them both together, then multiplying that by the relative
expense of the handler makes me say "show me" ;)
-
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:07    [W:0.036 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site