Using System Worker Threads

It is sometimes useful to delegate the completion of some non-time-critical tasks to a system worker thread. An example is the quiescing of some older, slower sound cards after wave output has completed.

For wave devices, soundlib.lib queues a worker routine that you specify as the HwStopDMA member in a WAVE_INFO structure. This routine is called after your DPC completes. (For more information, see SOUND_DEVICE_INIT.) Code in soundlib.lib calls ExInitializeWorkItem and ExQueueWorkItem to cause a system worker thread to execute the function pointed to by HwStopDMA in WAVE_INFO (which, in sndblst.sys, happens to be a function called HwStopDMA).