diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/intern/task.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/source/blender/blenlib/intern/task.c b/source/blender/blenlib/intern/task.c index f442a6219a5..08d40a158ca 100644 --- a/source/blender/blenlib/intern/task.c +++ b/source/blender/blenlib/intern/task.c @@ -508,16 +508,14 @@ BLI_INLINE bool parallel_range_next_iter_get( int * __restrict iter, int * __restrict count) { bool result = false; + BLI_spin_lock(&state->lock); if (state->iter < state->stop) { - BLI_spin_lock(&state->lock); - if (state->iter < state->stop) { - *count = min_ii(state->chunk_size, state->stop - state->iter); - *iter = state->iter; - state->iter += *count; - result = true; - } - BLI_spin_unlock(&state->lock); + *count = min_ii(state->chunk_size, state->stop - state->iter); + *iter = state->iter; + state->iter += *count; + result = true; } + BLI_spin_unlock(&state->lock); return result; } |