Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/tls/thread_local3g.C @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 84e7813d76e9 |
children |
line wrap: on
line source
// { dg-do run } // { dg-require-effective-target c++11 } // { dg-require-effective-target tls_runtime } // { dg-require-effective-target pthread } // { dg-require-cxa-atexit "" } // { dg-options -pthread } // { dg-add-options tls } int c; int d; struct A { A() { ++c; } ~A() { ++d; } }; thread_local A a; void *thread_main(void *) { A* ap = &a; return 0; } #include <pthread.h> int main() { pthread_t thread; pthread_create (&thread, 0, thread_main, 0); pthread_join(thread, 0); pthread_create (&thread, 0, thread_main, 0); pthread_join(thread, 0); if (c != 2 || d != 2) __builtin_abort(); }