Call flush_scheduled_work in the context of a work routine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The comment to flush_scheduled_work states that calling this function in the context of a work routine will lead to deadlock. I think it means following scenario:

static void
handler(struct work_struct *work)
{
    flush_scheduled_work();
}
static DECLARE_WORK(work, handler);
schedule_work(&work);

If this is true for system workqueue (system_wq) is it also applied to custom workqueue? I want to wait for completion of the workqueues in another workqueue. For example:

static void
handler(struct work_struct *work)
{
    struct work_data * data = "" work_data *)work;
    flush_scheduled_work();
    kfree(data);
}
  wq = create_workqueue("wq_test");
  data = "" work_data), GFP_KERNEL);
  INIT_WORK(&data->work, handler);
  queue_work(wq, &data->work);

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux