12/8/2023 0 Comments Work queue![]() ![]() This allows the handler to execute work in stages, without unduly delaying To the workqueue, since the work item is no longer queued at that time. The work item remains in its current place in the workqueue’s queue, andĪ handler function is permitted to re-submit its work item argument To submit a work item that is already queued the work item is not affected Workqueue whenever work needs to be performed. Thereby obtain access to the additional information it needs.Ī work item is typically initialized once and then submitted to a specific The handler function can then use the argument value to compute theĪddress of the enclosing data structure with CONTAINER_OF, and The work it is to perform, the work item can be embedded in a larger data If the handler function requires additional information about The single argument that is passed to a handler function can be ignored if it Its queue until the handler function finishes executing. Used with care, since the workqueue cannot process subsequent work items in Operations that are potentially blocking (e.g. ( k_work_is_pending()) or busy ( k_work_busy_get()).Ī handler function can use any kernel API available to threads. A work item that is in any of these states is pending Scheduled to be submitted to a (possibly different) queueĪll simultaneously. Marked canceling (because a thread used k_work_cancel_sync() to If it started running before a thread has requested that it be cancelled.Ī work item can be in multiple states for example it can be: On a work queue, and may also be canceling ( K_WORK_CANCELING) May remain in the queue for an extended period of time.Ī delayable work item may be scheduled ( K_WORK_DELAYED) to aĪ work item will be running ( K_WORK_RUNNING) when it is running Other items in the queue, a queued work item may be processed quickly or it The scheduling priority of the workqueue’s thread, and the work required by Item from the queue and invoke the work item’s handler function. The preceding work items in its queue the thread will remove the next work Once the workqueue’s thread has processed all of Submitting a work item appends the work item Item’s handler function and marks it as not pending.Ī work item may be queued ( K_WORK_QUEUED) by submitting it to a The work item also maintains information about its status.Ī work item must be initialized before it can be used. Thisįunction accepts a single argument, which is the address of the work item ![]() Each work item is referencedĪ work item is assigned a handler function, which is the functionĮxecuted by the workqueue’s thread when the work item is processed. See also WorkqueueĪny number of work items can be defined. ![]() Of the type observed with the previous implementation. K_work_is_pending(), or measurements of remaining time untilĭelayable work is scheduled, should be avoided to prevent race conditions Using the return values of k_work_busy_get() or Safe handling of work item resubmission when the item is being processed Specifically allowing a previous deadline to remain unchanged when a work The ability to wait until a work item has completed or a queue has beenįiner control of behavior when scheduling a delayable work item, K_NO_WAIT rather than always going through the timeout API, Checking of return values on cancellation is stillĭirect submission of delayable work items to the queue with Precise tracking of the status of cancelled work items, so that theĬaller need not be concerned that an item may be processing when theĬancellation returns. Implementation used prior to release 2.6. The behavior described here is changed from the Zephyr workqueue This sets its queue toĮmpty and spawns the workqueue’s thread. Regardless of workqueue thread priority the workqueue thread will yieldīetween each submitted work item, to prevent a cooperative workqueue fromĪ workqueue must be initialized before it can be used. Thread is configurable, allowing it to be either cooperative or preemptive Workqueue is referenced by its memory address.Ī workqueue has the following key properties:Ī queue of work items that have been added, but not yet processed.Ī thread that processes the work items in the queue. To a lower-priority thread so it does not impact time-sensitive processing.Īny number of workqueues can be defined (limited only by available RAM). Used by an ISR or a high-priority thread to offload non-urgent processing Each work item is processed byĬalling the function specified by the work item. Work items in a first in, first out manner. A workqueue is a kernel object that uses a dedicated thread to process
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |