Currently only a single flag is defined: work_struct_pending allows for finding out whether a delayable work item is currently pending (if the bit is set) or not. The auxiliary macro work_pending(work) allows for checking for the bit. Note that the atomic data type of data ensures that the bit can be modified without concurrency problems.

To simplify declaring and filling a static instance of this structure, the kernel provides the INIT_WORK(work, func) macro, which supplies an existing instance of work_struct with a delayed function. If a data argument is required, it must be set afterward.

There are two ways of adding a work_queue instance to a work queue — queue_work and queue_work_delayed. The first alternative has the following prototype:

Continue reading here: Info

Was this article helpful?

0 0