]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/thread-local-atexit-macOS.dtest/main.cpp
3 // BUILD: $CXX main.cpp -std=c++11 -o $BUILD_DIR/thread-local-atexit-macOS.exe
5 // RUN: ./thread-local-atexit-macOS.exe
11 // We create an A and a B.
12 // While destroying B we create a C
13 // Given that tlv_finalize has "destroy in reverse order of construction", we
14 // must then immediately destroy C before we destroy A to maintain that invariant
45 if ( state
!= None
) {
46 printf("[FAIL] thread-local-atexit-macOS: should be in the 'None' state\n");
52 if ( state
!= ConstructedA
) {
53 printf("[FAIL] thread-local-atexit-macOS: should be in the 'ConstructedA' state\n");
60 // We construct C during B's destructor
61 if ( state
!= DestroyingB
) {
62 printf("[FAIL] thread-local-atexit-macOS: should be in the 'DestroyingB' state\n");
70 if ( state
!= ConstructedB
) {
71 printf("[FAIL] thread-local-atexit-macOS: should be in the 'ConstructedB' state\n");
75 static thread_local C c
;
76 if ( state
!= ConstructedC
) {
77 printf("[FAIL] thread-local-atexit-macOS: should be in the 'ConstructedC' state\n");
85 if ( state
!= DestroyedB
) {
86 printf("[FAIL] thread-local-atexit-macOS: should be in the 'DestroyedB' state\n");
92 // And finally destroy A
94 if ( state
!= DestroyedC
) {
95 printf("[FAIL] thread-local-atexit-macOS: should be in the 'DestroyedC' state\n");
99 printf("[PASS] thread-local-atexit-macOS\n");
104 thread_local A a
= {};
105 thread_local B b
= {};
109 printf("[BEGIN] thread-local-atexit-macOS\n");