Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/tls/thread_local6.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
// Test for cleanups in the main thread without -pthread. /* wrapping doesn't reflect _exit value */ // { dg-do run { target { c++11 && unwrapped } } } // { dg-add-options tls } // { dg-require-effective-target tls_runtime } extern "C" void _exit (int); int c; struct A { A() { ++c; } ~A() { if (c == 1) _exit(0); } }; void f() { thread_local A a; } void *thread_main(void *) { f(); f(); f(); return 0; } int main() { thread_main(0); // The dtor for a in the main thread is run after main exits, so we // return 1 now and override the return value with _exit above. return 1; }