1.. _module-pw_work_queue: 2 3============= 4pw_work_queue 5============= 6The ``pw_work_queue`` module contains utilities for deferring work to be 7executed by another thread. 8 9.. warning:: 10 11 This module is still under construction; the API is not yet stable. 12 13------- 14Example 15------- 16 17.. code-block:: cpp 18 19 #include "pw_thread/detached_thread.h" 20 #include "pw_work_queue/work_queue.h" 21 22 pw::work_queue::WorkQueueWithBuffer<10> work_queue; 23 24 pw::thread::Options& WorkQueueThreadOptions(); 25 void SomeLongRunningProcessing(); 26 27 void SomeInterruptHandler() { 28 // Instead of executing the long running processing task in the interrupt, 29 // the work_queue executes it on the interrupt's behalf. 30 work_queue.CheckPushWork(SomeLongRunningProcessing); 31 } 32 33 int main() { 34 // Start up the work_queue as a detached thread which runs forever. 35 pw::thread::DetachedThread(WorkQueueThreadOptions(), work_queue); 36 } 37 38------------- 39API reference 40------------- 41.. doxygennamespace:: pw::work_queue 42 :members: 43