diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-07-15 07:43:25 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-07-15 07:45:46 +0300 |
commit | 15cdcb4e9085c3cf35528c2f7e559955b4ff531a (patch) | |
tree | 06507320da857519d4f2cf1511f5a832dce5bf61 /source/blender/blenlib/BLI_task.h | |
parent | 5cd1aaf0808f2bac11fadcf8c351429de54ac68a (diff) |
BLI_task: add a callback to initialize TLS
Useful when TLS requires it's own allocated structures.
Diffstat (limited to 'source/blender/blenlib/BLI_task.h')
-rw-r--r-- | source/blender/blenlib/BLI_task.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h index dbe8ec3dcc0..418db14e2f3 100644 --- a/source/blender/blenlib/BLI_task.h +++ b/source/blender/blenlib/BLI_task.h @@ -129,6 +129,9 @@ typedef struct TaskParallelTLS { typedef void (*TaskParallelRangeFunc)(void *__restrict userdata, const int iter, const TaskParallelTLS *__restrict tls); + +typedef void (*TaskParallelInitFunc)(const void *__restrict userdata, void *__restrict chunk); + typedef void (*TaskParallelReduceFunc)(const void *__restrict userdata, void *__restrict chunk_join, void *__restrict chunk); @@ -151,6 +154,10 @@ typedef struct TaskParallelSettings { /* Function called from calling thread once whole range have been * processed. */ + /* Function called to initialize user data chunk, + * typically to allocate data, freed by `func_free`. + */ + TaskParallelInitFunc func_init; /* Function called to join user data chunk into another, to reduce * the result to the original userdata_chunk memory. * The reduce functions should have no side effects, so that they |