|
Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
Lock-free cooperative gate for pausing a worker thread. More...
#include <MediaPipelineWebOS.h>
Classes | |
| class | Lock |
| RAII guard – pauses the worker on construction, resumes on destruction. More... | |
Public Member Functions | |
| void | Checkpoint () |
| Called by the worker thread at the top of every loop iteration. | |
| void | OnExit () |
| Called by the worker thread just before it exits its loop. | |
| void | SetRunning (const bool running) |
| Indicate whether the associated worker thread is running. | |
Lock-free cooperative gate for pausing a worker thread.
The worker calls Checkpoint() each loop iteration. If a pause has been requested it blocks (via std::atomic::wait) until the requester releases.
Other threads obtain a Lock RAII guard which requests the pause, waits for the worker to reach its checkpoint, and resumes the worker on destruction.
|
inline |
Called by the worker thread at the top of every loop iteration.
If a pause has been requested the call blocks until the requester calls Resume() (typically via Lock destruction).
|
inline |
Called by the worker thread just before it exits its loop.
Ensures any thread blocked in Pause() is woken up.
Indicate whether the associated worker thread is running.
Must be set to true before the worker loop and false after.