All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mikkel Christiansen <mixxel@cs.auc.dk>
To: linux-kernel@vger.kernel.org
Subject: workqueue and pending
Date: Mon, 03 May 2004 13:39:33 +0200	[thread overview]
Message-ID: <40962F75.8000200@cs.auc.dk> (raw)

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



             reply	other threads:[~2004-05-03 11:37 UTC|newest]

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

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=40962F75.8000200@cs.auc.dk \
    --to=mixxel@cs.auc.dk \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.