diff options
author | Tejun Heo <tj@kernel.org> | 2011-04-05 12:01:44 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2011-05-20 07:54:46 -0400 |
commit | 9c5a2ba70251ecaab18c7a83e38b3c620223476c (patch) | |
tree | ece2c035b761af1332ea027f32443a6d05b16bc9 /include/linux/workqueue.h | |
parent | 2543a87108d2af7d48a43b3d6685c2b1ea279e36 (diff) |
workqueue: separate out drain_workqueue() from destroy_workqueue()
There are users which want to drain workqueues without destroying it.
Separate out drain functionality from destroy_workqueue() into
drain_workqueue() and make it accessible to workqueue users.
To guarantee forward-progress, only chain queueing is allowed while
drain is in progress. If a new work item which isn't chained from the
running or pending work items is queued while draining is in progress,
WARN_ON_ONCE() is triggered.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: James Bottomley <James.Bottomley@hansenpartnership.com>
Diffstat (limited to 'include/linux/workqueue.h')
-rw-r--r-- | include/linux/workqueue.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 57b31b3d83b..2be2887c695 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -255,7 +255,7 @@ enum { | |||
255 | WQ_HIGHPRI = 1 << 4, /* high priority */ | 255 | WQ_HIGHPRI = 1 << 4, /* high priority */ |
256 | WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ | 256 | WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ |
257 | 257 | ||
258 | WQ_DYING = 1 << 6, /* internal: workqueue is dying */ | 258 | WQ_DRAINING = 1 << 6, /* internal: workqueue is draining */ |
259 | WQ_RESCUER = 1 << 7, /* internal: workqueue has rescuer */ | 259 | WQ_RESCUER = 1 << 7, /* internal: workqueue has rescuer */ |
260 | 260 | ||
261 | WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */ | 261 | WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */ |
@@ -355,6 +355,7 @@ extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, | |||
355 | struct delayed_work *work, unsigned long delay); | 355 | struct delayed_work *work, unsigned long delay); |
356 | 356 | ||
357 | extern void flush_workqueue(struct workqueue_struct *wq); | 357 | extern void flush_workqueue(struct workqueue_struct *wq); |
358 | extern void drain_workqueue(struct workqueue_struct *wq); | ||
358 | extern void flush_scheduled_work(void); | 359 | extern void flush_scheduled_work(void); |
359 | 360 | ||
360 | extern int schedule_work(struct work_struct *work); | 361 | extern int schedule_work(struct work_struct *work); |