From b84e6dfee4a82b4142651710cbe842f8d021a861 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 23 Nov 2017 21:12:00 +0100 Subject: 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). --- source/blender/blenlib/BLI_mempool.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/blenlib/BLI_mempool.h') 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 -- cgit v1.2.3