From f38ba5c864ca09b2be8906ae2b0a81e8a57b734b Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Thu, 9 Apr 2020 00:17:22 +0200 Subject: an example with two threads --- test/monniaux/thread_local/thread_local2.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/monniaux/thread_local/thread_local2.c (limited to 'test/monniaux/thread_local/thread_local2.c') 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 +#include + +_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; +} -- cgit