Commit 81dcaf6516d8bbd75b894862c8ae7bba04380cfe
1 parent
151b6a5f1d
Exists in
master
and in
7 other branches
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>
Showing 1 changed file with 18 additions and 0 deletions Side-by-side Diff
include/linux/workqueue.h
... | ... | @@ -306,6 +306,24 @@ |
306 | 306 | __alloc_workqueue_key((name), (flags), (max_active), NULL, NULL) |
307 | 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 | 327 | #define create_workqueue(name) \ |
310 | 328 | alloc_workqueue((name), WQ_RESCUER, 1) |
311 | 329 | #define create_freezeable_workqueue(name) \ |