diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-11-23 23:12:00 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-11-23 23:12:00 +0300 |
commit | b84e6dfee4a82b4142651710cbe842f8d021a861 (patch) | |
tree | 78250ce98c1b1dbe68ba71bb77de73ef7d9b2437 /source/blender/blenlib/BLI_mempool.h | |
parent | ff9eab7926da46d62cede2d3d061fcfe2531f622 (diff) |
Add ability to use more than one mempool iterator simultaneously.
This will allow threaded tasks to 'consume' all mempool items in
parallel tasks, each one working on a whole chunk at once (to reduce
concurrency managing overhead).
Diffstat (limited to 'source/blender/blenlib/BLI_mempool.h')
-rw-r--r-- | source/blender/blenlib/BLI_mempool.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h index 0c754f551e0..b68ca6b1f2b 100644 --- a/source/blender/blenlib/BLI_mempool.h +++ b/source/blender/blenlib/BLI_mempool.h @@ -71,6 +71,8 @@ typedef struct BLI_mempool_iter { BLI_mempool *pool; struct BLI_mempool_chunk *curchunk; unsigned int curindex; + + struct BLI_mempool_chunk **curchunk_threaded_shared; } BLI_mempool_iter; /* flag */ @@ -87,6 +89,9 @@ enum { void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter) ATTR_NONNULL(); void *BLI_mempool_iterstep(BLI_mempool_iter *iter) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +BLI_mempool_iter *BLI_mempool_iter_threadsafe_create(BLI_mempool *pool, const size_t num_iter) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +void BLI_mempool_iter_threadsafe_free(BLI_mempool_iter *iter_arr) ATTR_NONNULL(); + #ifdef __cplusplus } #endif |