Messages in this thread | | | Subject | Re: [PATCH] add unschedule_delayed_work to the workqueue API | From | James Bottomley <> | Date | 18 Oct 2004 16:47:22 -0500 |
| |
On Mon, 2004-10-18 at 16:43, Andrew Morton wrote: > James Bottomley <James.Bottomley@SteelEye.com> wrote: > > > > On Mon, 2004-10-18 at 16:26, James Bottomley wrote: > > > On Mon, 2004-10-18 at 16:25, Andrew Morton wrote: > > > > The usual way of doing this is: > > > > > > > > cancel_delayed_work(...); > > > > 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. 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 missing link is cancellation of a delayed work which re-adds itself and > where the calling code has no way of telling the handler to not re-arm > itself. There's a patch in -mm to add that function, but I don't like it. > That's cancel_rearming_delayed_work.patch.
James
- 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/
| |