diff options
author | Tejun Heo <tj@kernel.org> | 2010-09-16 04:17:35 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2010-09-19 11:51:05 -0400 |
commit | 81dcaf6516d8bbd75b894862c8ae7bba04380cfe (patch) | |
tree | 57545ae02e78513cb75d4e9472772ebb2e4408f2 /include/linux/workqueue.h | |
parent | 151b6a5f1d4c547c92ec67a5a6fedc16f435956e (diff) |
workqueue: implement alloc_ordered_workqueue()
alloc_ordered_workqueue() creates a workqueue which processes each
work itemp one by one in the queued order. This will be used to
replace create_freezeable_workqueue() and
create_singlethread_workqueue().
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/workqueue.h')
-rw-r--r-- | include/linux/workqueue.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 25e02c941bac..07c48925a8fc 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -306,6 +306,24 @@ __alloc_workqueue_key(const char *name, unsigned int flags, int max_active, | |||
306 | __alloc_workqueue_key((name), (flags), (max_active), NULL, NULL) | 306 | __alloc_workqueue_key((name), (flags), (max_active), NULL, NULL) |
307 | #endif | 307 | #endif |
308 | 308 | ||
309 | /** | ||
310 | * alloc_ordered_workqueue - allocate an ordered workqueue | ||
311 | * @name: name of the workqueue | ||
312 | * @flags: WQ_* flags (only WQ_FREEZEABLE and WQ_RESCUER are meaningful) | ||
313 | * | ||
314 | * Allocate an ordered workqueue. An ordered workqueue executes at | ||
315 | * most one work item at any given time in the queued order. They are | ||
316 | * implemented as unbound workqueues with @max_active of one. | ||
317 | * | ||
318 | * RETURNS: | ||
319 | * Pointer to the allocated workqueue on success, %NULL on failure. | ||
320 | */ | ||
321 | static inline struct workqueue_struct * | ||
322 | alloc_ordered_workqueue(const char *name, unsigned int flags) | ||
323 | { | ||
324 | return alloc_workqueue(name, WQ_UNBOUND | flags, 1); | ||
325 | } | ||
326 | |||
309 | #define create_workqueue(name) \ | 327 | #define create_workqueue(name) \ |
310 | alloc_workqueue((name), WQ_RESCUER, 1) | 328 | alloc_workqueue((name), WQ_RESCUER, 1) |
311 | #define create_freezeable_workqueue(name) \ | 329 | #define create_freezeable_workqueue(name) \ |