1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
commit 244002b418cd00f566113732071aca1874eee77d
Author: François Trahay <francois.trahay@telecom-sudparis.eu>
Date: Tue Aug 23 11:59:41 2022 +0200
use _Atomic instead of __atomic_fetch_add
diff --git a/src/eztrace-lib/pthread_core.c b/src/eztrace-lib/pthread_core.c
index c9ec1f19..2dd2dd93 100644
--- a/src/eztrace-lib/pthread_core.c
+++ b/src/eztrace-lib/pthread_core.c
@@ -20,6 +20,7 @@
#include <unistd.h>
#include <sched.h>
#include <sys/syscall.h>
+#include <stdatomic.h>
#define CURRENT_MODULE eztrace_core
DECLARE_CURRENT_MODULE;
@@ -48,7 +49,7 @@ struct _pthread_create_info_t {
void* arg;
};
-static int nb_threads=0;
+static _Atomic int nb_threads=0;
static int working_id = -1;
extern int current_process_ref;
@@ -155,7 +156,7 @@ void ezt_init_thread() {
return;
/* atomically increment nb_threads */
- thread_rank = __atomic_fetch_add(&nb_threads, 1, __ATOMIC_SEQ_CST);
+ thread_rank = nb_threads++;
_ezt_register_thread();
thread_status = ezt_trace_status_running;
|