mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Mikkel Christiansen <mixxel@cs.auc.dk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: workqueue and pending
Date: Mon, 3 May 2004 16:27:19 -0700	[thread overview]
Message-ID: <20040503162719.54fb7020.akpm@osdl.org> (raw)
In-Reply-To: <40962F75.8000200@cs.auc.dk>

Mikkel Christiansen <mixxel@cs.auc.dk> wrote:
>
> 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.

It looks like nobody has tried to do that yet.

> 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.

Does this work?

--- 25/include/linux/workqueue.h~cancel_delayed_work-fix	Mon May  3 16:24:46 2004
+++ 25-akpm/include/linux/workqueue.h	Mon May  3 16:26:01 2004
@@ -7,6 +7,7 @@
 
 #include <linux/timer.h>
 #include <linux/linkage.h>
+#include <linux/bitops.h>
 
 struct workqueue_struct;
 
@@ -75,8 +76,11 @@ extern void init_workqueues(void);
  */
 static inline int cancel_delayed_work(struct work_struct *work)
 {
-	return del_timer_sync(&work->timer);
+	int ret;
+
+	ret = del_timer_sync(&work->timer);
+	clear_bit(0, &work->pending);
+	return ret;
 }
 
 #endif
-

_


  reply	other threads:[~2004-05-03 23:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-03 11:39 Mikkel Christiansen
2004-05-03 23:27 ` Andrew Morton [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040503162719.54fb7020.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mixxel@cs.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®