Showing the changes to kernel/workqueue.c (1 of 863 files). Show all
Unified · Split
| @@ -4179,6 +4179,22 @@ void workqueue_set_max_active(struct workqueue_struct *wq, int max_active) · 4178 unmodified lines | ||
| 4179 | 4179 | } |
| 4180 | 4180 | EXPORT_SYMBOL_GPL(workqueue_set_max_active); |
| 4181 | 4181 | |
| 4182 | +/** | |
| 4183 | + * current_work - retrieve %current task's work struct | |
| 4184 | + * | |
| 4185 | + * Determine if %current task is a workqueue worker and what it's working on. | |
| 4186 | + * Useful to find out the context that the %current task is running in. | |
| 4187 | + * | |
| 4188 | + * Return: work struct if %current task is a workqueue worker, %NULL otherwise. | |
| 4189 | + */ | |
| 4190 | +struct work_struct *current_work(void) | |
| 4191 | +{ | |
| 4192 | + struct worker *worker = current_wq_worker(); | |
| 4193 | + | |
| 4194 | + return worker ? worker->current_work : NULL; | |
| 4195 | +} | |
| 4196 | +EXPORT_SYMBOL(current_work); | |
| 4197 | + | |
| 4182 | 4198 | /** |
| 4183 | 4199 | * current_is_workqueue_rescuer - is %current workqueue rescuer? |
| 4184 | 4200 | * |