Two important aspects of the schedule_work() function are not yet documented: - that it is allowed to pass a struct work_struct * to this function that is already on the kernel-global workqueue; - the meaning of its return value. The patch below documents both aspects.
Showing the changes to kernel/workqueue.c (1 of 1 file). Show all
Unified · Split
| @@ -600,7 +600,12 @@ static struct workqueue_struct *keventd_wq __read_mostly; · 599 unmodified lines | |||
| 600 | * schedule_work - put work task in global workqueue | 600 | * schedule_work - put work task in global workqueue |
| 601 | * @work: job to be done | 601 | * @work: job to be done |
| 602 | * | 602 | * |
| 603 | * This puts a job in the kernel-global workqueue. | 603 | * Returns zero if @work was already on the kernel-global workqueue and |
| 604 | * non-zero otherwise. | ||
| 605 | * | ||
| 606 | * This puts a job in the kernel-global workqueue if it was not already | ||
| 607 | * queued and leaves it in the same position on the kernel-global | ||
| 608 | * workqueue otherwise. | ||
| 604 | */ | 609 | */ |
| 605 | int schedule_work(struct work_struct *work) | 610 | int schedule_work(struct work_struct *work) |
| 606 | { | 611 | { |