We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aa68509 commit 997ff24Copy full SHA for 997ff24
1 file changed
tests/regression/82-barrier/12-init.c
@@ -0,0 +1,37 @@
1
+// NOMAC PARAM: --set ana.activated[+] 'pthreadBarriers'
2
+#include<pthread.h>
3
+#include<stdio.h>
4
+#include<unistd.h>
5
+
6
+int g;
7
8
+pthread_barrier_t barrier;
9
+pthread_mutex_t mutex;
10
11
+void* thread_func(void* arg) {
12
+ // Some initialization code
13
+ pthread_barrier_wait(&barrier);
14
15
+ pthread_mutex_lock(&mutex);
16
+ g = 5; //NORACE
17
+ pthread_mutex_unlock(&mutex);
18
19
+ return NULL;
20
+}
21
22
23
24
+int main(int argc, char const *argv[])
25
+{
26
+ pthread_t worker1, worker2;
27
28
+ pthread_barrier_init(&barrier, NULL, 3);
29
30
+ pthread_create(&worker1, NULL, thread_func, NULL);
31
+ pthread_create(&worker2, NULL, thread_func, NULL);
32
33
+ g = 8; //NORACE
34
35
36
+ return 0;
37
0 commit comments