diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-11-15 14:16:26 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-11-15 14:16:26 +0300 |
commit | 4ee08e9533593b0e7cf7f50b3c4c61eb5598c13e (patch) | |
tree | ba0fca216507394e81ae60205c374455d79ef009 /source | |
parent | 46b5cdaa4d1b9d78bbbd078e98f64de1e6c288a8 (diff) |
Atomics: Make naming more obvious about which value is being returned
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/dynamicpaint.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh_evaluate.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pbvh.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/task.c | 8 | ||||
-rw-r--r-- | source/blender/compositor/intern/COM_ExecutionGroup.cpp | 2 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval.cc | 4 | ||||
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 2 | ||||
-rw-r--r-- | source/gameengine/VideoTexture/VideoDeckLink.cpp | 4 |
9 files changed, 15 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 02ae123a71e..50f8423bbff 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -3284,7 +3284,7 @@ void DAG_threaded_update_handle_node_updated(void *node_v, for (itA = node->child; itA; itA = itA->next) { DagNode *child_node = itA->node; if (child_node != node) { - atomic_sub_uint32(&child_node->num_pending_parents, 1); + atomic_sub_and_fetch_uint32(&child_node->num_pending_parents, 1); if (child_node->num_pending_parents == 0) { bool need_schedule; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index c7399047ed5..66070923153 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -2264,7 +2264,7 @@ static void dynamic_paint_create_uv_surface_neighbor_cb(void *userdata, const in * to non--1 *before* its tri_index is set (i.e. that it cannot be used a neighbour). */ tPoint->neighbour_pixel = ind - 1; - atomic_add_uint32(&tPoint->neighbour_pixel, 1); + atomic_add_and_fetch_uint32(&tPoint->neighbour_pixel, 1); tPoint->tri_index = i; /* Now calculate pixel data for this pixel as it was on polygon surface */ @@ -2289,7 +2289,7 @@ static void dynamic_paint_create_uv_surface_neighbor_cb(void *userdata, const in /* Increase the final number of active surface points if relevant. */ if (tPoint->tri_index != -1) - atomic_add_uint32(active_points, 1); + atomic_add_and_fetch_uint32(active_points, 1); } } diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index 016c9c863f0..a3fe73e4b11 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -238,7 +238,7 @@ static void mesh_calc_normals_poly_accum_task_cb(void *userdata, const int pidx) /* accumulate */ for (int k = 3; k--; ) { - atomic_add_fl(&vnors[ml[i].v][k], pnor[k] * fac); + atomic_add_and_fetch_fl(&vnors[ml[i].v][k], pnor[k] * fac); } prev_edge = cur_edge; } diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index ff69f381b06..4fe4d6e75a6 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -977,7 +977,7 @@ static void pbvh_update_normals_accum_task_cb(void *userdata, const int n) * Not exact equivalent though, since atomicity is only ensured for one component * of the vector at a time, but here it shall not make any sensible difference. */ for (int k = 3; k--; ) { - atomic_add_fl(&vnors[v][k], fn[k]); + atomic_add_and_fetch_fl(&vnors[v][k], fn[k]); } } } diff --git a/source/blender/blenlib/intern/task.c b/source/blender/blenlib/intern/task.c index 436cd2b8fde..fc2d9674c2f 100644 --- a/source/blender/blenlib/intern/task.c +++ b/source/blender/blenlib/intern/task.c @@ -237,7 +237,7 @@ static void task_pool_num_decrease(TaskPool *pool, size_t done) BLI_assert(pool->num >= done); pool->num -= done; - atomic_sub_z(&pool->currently_running_tasks, done); + atomic_sub_and_fetch_z(&pool->currently_running_tasks, done); pool->done += done; if (pool->num == 0) @@ -292,7 +292,7 @@ static bool task_scheduler_thread_wait_pop(TaskScheduler *scheduler, Task **task continue; } - if (atomic_add_z(&pool->currently_running_tasks, 1) <= pool->num_threads || + if (atomic_add_and_fetch_z(&pool->currently_running_tasks, 1) <= pool->num_threads || pool->num_threads == 0) { *task = current_task; @@ -301,7 +301,7 @@ static bool task_scheduler_thread_wait_pop(TaskScheduler *scheduler, Task **task break; } else { - atomic_sub_z(&pool->currently_running_tasks, 1); + atomic_sub_and_fetch_z(&pool->currently_running_tasks, 1); } } if (!found_task) @@ -669,7 +669,7 @@ void BLI_task_pool_work_and_wait(TaskPool *pool) /* if found task, do it, otherwise wait until other tasks are done */ if (found_task) { /* run task */ - atomic_add_z(&pool->currently_running_tasks, 1); + atomic_add_and_fetch_z(&pool->currently_running_tasks, 1); work_task->run(pool, work_task->taskdata, 0); /* delete task */ diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp index e5c2b8ace4e..9a47c6b2438 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp @@ -383,7 +383,7 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo if (this->m_chunkExecutionStates[chunkNumber] == COM_ES_SCHEDULED) this->m_chunkExecutionStates[chunkNumber] = COM_ES_EXECUTED; - atomic_add_u(&this->m_chunksFinished, 1); + atomic_add_and_fetch_u(&this->m_chunksFinished, 1); if (memoryBuffers) { for (unsigned int index = 0; index < this->m_cachedMaxReadBufferOffset; index++) { MemoryBuffer *buffer = memoryBuffers[index]; diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index c3fd202d832..e926f83bcbe 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -152,7 +152,7 @@ static void deg_task_run_func(TaskPool *pool, } if ((rel->flag & DEPSREL_FLAG_CYCLIC) == 0) { BLI_assert(child->num_links_pending > 0); - atomic_sub_uint32(&child->num_links_pending, 1); + atomic_sub_and_fetch_uint32(&child->num_links_pending, 1); } if (child->num_links_pending == 0) { bool is_scheduled = atomic_fetch_and_or_uint8( @@ -287,7 +287,7 @@ static void schedule_node(TaskPool *pool, Depsgraph *graph, unsigned int layers, { if (dec_parents) { BLI_assert(node->num_links_pending > 0); - atomic_sub_uint32(&node->num_links_pending, 1); + atomic_sub_and_fetch_uint32(&node->num_links_pending, 1); } if (node->num_links_pending == 0) { diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 6af36ea6778..83469a48165 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -2510,7 +2510,7 @@ static void filelist_readjob_do( * Using an atomic operation to avoid having to lock thread... * Note that we do not really need this here currently, since there is a single listing thread, but better * remain consistent about threading! */ - *((uint32_t *)entry->uuid) = atomic_add_uint32((uint32_t *)filelist->filelist_intern.curr_uuid, 1); + *((uint32_t *)entry->uuid) = atomic_add_and_fetch_uint32((uint32_t *)filelist->filelist_intern.curr_uuid, 1); /* Only thing we change in direntry here, so we need to free it first. */ MEM_freeN(entry->relpath); diff --git a/source/gameengine/VideoTexture/VideoDeckLink.cpp b/source/gameengine/VideoTexture/VideoDeckLink.cpp index 4f5e34896fc..c588a4b33cf 100644 --- a/source/gameengine/VideoTexture/VideoDeckLink.cpp +++ b/source/gameengine/VideoTexture/VideoDeckLink.cpp @@ -544,12 +544,12 @@ HRESULT STDMETHODCALLTYPE PinnedMemoryAllocator::QueryInterface(REFIID /*iid*/, ULONG STDMETHODCALLTYPE PinnedMemoryAllocator::AddRef(void) { - return atomic_add_uint32(&mRefCount, 1U); + return atomic_add_and_fetch_uint32(&mRefCount, 1U); } ULONG STDMETHODCALLTYPE PinnedMemoryAllocator::Release(void) { - uint32_t newCount = atomic_sub_uint32(&mRefCount, 1U); + uint32_t newCount = atomic_sub_and_fetch_uint32(&mRefCount, 1U); if (newCount == 0) delete this; return (ULONG)newCount; |