aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/thread_local
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2020-04-09 00:17:22 +0200
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2020-04-09 00:17:22 +0200
commitf38ba5c864ca09b2be8906ae2b0a81e8a57b734b (patch)
treede756acee9f840eb663d34f129d4eb76fabbf537 /test/monniaux/thread_local
parent3d73bc6d86ceed29317f9d51c3da617613bab595 (diff)
downloadcompcert-kvx-f38ba5c864ca09b2be8906ae2b0a81e8a57b734b.tar.gz
compcert-kvx-f38ba5c864ca09b2be8906ae2b0a81e8a57b734b.zip
an example with two threads
Diffstat (limited to 'test/monniaux/thread_local')
-rw-r--r--test/monniaux/thread_local/thread_local2.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/monniaux/thread_local/thread_local2.c b/test/monniaux/thread_local/thread_local2.c
new file mode 100644
index 00000000..ba244ac6
--- /dev/null
+++ b/test/monniaux/thread_local/thread_local2.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <pthread.h>
+
+_Thread_local int toto;
+_Thread_local int toto2 = 45;
+
+void* poulet(void * dummy) {
+ printf("%p %p\n", &toto, &toto2);
+ return NULL;
+}
+
+int main() {
+ pthread_t thr;
+ poulet(NULL);
+ pthread_create(&thr, NULL, poulet, NULL);
+ pthread_join(thr, NULL);
+ return 0;
+}