diff src/parallel_execution/CPUWorker.cbc @ 372:d6ce4273e7d1

Add dimension task spawn
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Tue, 11 Jul 2017 17:47:11 +0900
parents 534601ed8c50
children fb50cf8aa615
line wrap: on
line diff
--- a/src/parallel_execution/CPUWorker.cbc	Fri Jul 07 14:58:26 2017 +0900
+++ b/src/parallel_execution/CPUWorker.cbc	Tue Jul 11 17:47:11 2017 +0900
@@ -88,8 +88,9 @@
 }
 
 __code odgCommit3(struct TaskManager* taskManager, struct Context* task) {
-    if(__sync_fetch_and_sub(&task->idgCount, 1)) {
-        if(task->idgCount == 0) {
+    int idgCount = task->idgCount;
+    if(__sync_bool_compare_and_swap(&task->idgCount, idgCount, idgCount-1)) { // atomic decrement idg counter
+        if(idgCount-1 == 0) {
             taskManager->taskManager = (union Data*)task->taskManager;
             taskManager->context = task;
             taskManager->next = C_odgCommit1;