diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-04-09 00:17:22 +0200 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-04-09 00:17:22 +0200 |
commit | f38ba5c864ca09b2be8906ae2b0a81e8a57b734b (patch) | |
tree | de756acee9f840eb663d34f129d4eb76fabbf537 /test/monniaux/thread_local | |
parent | 3d73bc6d86ceed29317f9d51c3da617613bab595 (diff) | |
download | compcert-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.c | 18 |
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; +} |