Prechádzať zdrojové kódy

fix concurrent incrementation

Olivier Aumage 8 rokov pred
rodič
commit
f0c0dfeb76
1 zmenil súbory, kde vykonal 4 pridanie a 1 odobranie
  1. 4 1
      examples/sched_ctx/nested_sched_ctxs.c

+ 4 - 1
examples/sched_ctx/nested_sched_ctxs.c

@@ -53,7 +53,10 @@ static void sched_ctx_func(void *descr[] STARPU_ATTRIBUTE_UNUSED, void *arg)
 	unsigned sched_ctx = (uintptr_t)arg;
 	int t = parallel_code(sched_ctx);
 	if (sched_ctx > 0 && sched_ctx < 3)
-		tasks_executed[sched_ctx-1] += t;
+	{
+		STARPU_ATOMIC_ADD(&tasks_executed[sched_ctx-1], t);
+	}
+
 	//printf("w %d executed %d it \n", w, n);
 }