diff options
author | Marat Dukhan <maratek@google.com> | 2020-03-05 13:38:29 -0800 |
---|---|---|
committer | Marat Dukhan <maratek@google.com> | 2020-03-05 13:38:29 -0800 |
commit | ef23a4af82e34a4785c56b5fbae631efbcb77aea (patch) | |
tree | 1e84c34157bb96ce9f0dfced1ae2324d86481d1d /include | |
parent | efa3c028d0f7b0414f0738a706f8187430425477 (diff) | |
download | pthreadpool-ef23a4af82e34a4785c56b5fbae631efbcb77aea.tar.gz |
PTHREADPOOL_FLAG_YIELD_WORKERS flag to bypass spin-wait
Makes it possible to signal the last operation in a sequence of computations,
so pthreadpool workers don't spin in vain.
Diffstat (limited to 'include')
-rw-r--r-- | include/pthreadpool.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/pthreadpool.h b/include/pthreadpool.h index d15bf3f..30471e6 100644 --- a/include/pthreadpool.h +++ b/include/pthreadpool.h @@ -32,6 +32,15 @@ typedef void (*pthreadpool_task_6d_tile_2d_t)(void*, size_t, size_t, size_t, siz */ #define PTHREADPOOL_FLAG_DISABLE_DENORMALS 0x00000001 +/** + * Yield worker threads to the system scheduler after the operation is finished. + * + * Force workers to use kernel wait (instead of active spin-wait by default) for new commands after this command is + * processed. This flag affects only the immediate next operation on this thread pool. To make the thread pool always + * use kernel wait, pass this flag to all parallelization functions. + */ +#define PTHREADPOOL_FLAG_YIELD_WORKERS 0x00000002 + #ifdef __cplusplus extern "C" { #endif |