Code refactoring of tests/subthread_create regarding AO add primitive
authorIvan Maidanski <ivmai@mail.ru>
Thu, 29 Sep 2016 21:16:43 +0000 (00:16 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 29 Sep 2016 21:16:43 +0000 (00:16 +0300)
* tests/subthread_create.c (entry): Use AO_fetch_and_add1(&v) instead
of AO_fetch_and_add(&v,1).

tests/subthread_create.c

index 9a7095b..be57896 100644 (file)
@@ -48,7 +48,7 @@ volatile AO_t thread_ended_cnt = 0;
   DWORD WINAPI entry(LPVOID arg)
 #endif
 {
-    int thread_num = AO_fetch_and_add(&thread_created_cnt, 1);
+    int thread_num = AO_fetch_and_add1(&thread_created_cnt);
     GC_word my_depth = (GC_word)arg + 1;
 
     if (my_depth <= MAX_SUBTHREAD_DEPTH
@@ -78,7 +78,7 @@ volatile AO_t thread_ended_cnt = 0;
 # endif
     }
 
-    AO_fetch_and_add(&thread_ended_cnt, 1);
+    (void)AO_fetch_and_add1(&thread_ended_cnt);
     return 0;
 }