PFB the pseudo code:
struct work_struct my_work;
my_wq = alloc_workqueue();
INIT_WORK(&my_work, worker_func);
void worker_func() {
if (condition)
queue_work(my_wq, my_work);
}
Is this allowed?
PFB the pseudo code:
struct work_struct my_work;
my_wq = alloc_workqueue();
INIT_WORK(&my_work, worker_func);
void worker_func() {
if (condition)
queue_work(my_wq, my_work);
}
Is this allowed?
Yes, it is perfectly allowed to re-submit a work while its function is executed.
It is also allowed to de-allocate the work structure which function is executed. Workqueue implementation is ready for that (kernel/workqueue.c):