1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 int cxa_thread_atexit_test_var = 0; 17 18 class A 19 { 20 public: 21 A(); 22 ~A(); 23 void Test(); 24 }; 25 A()26A::A() 27 { 28 cxa_thread_atexit_test_var += 1; 29 } 30 ~A()31A::~A() 32 { 33 cxa_thread_atexit_test_var -= 1; 34 } 35 Test()36void A::Test() 37 { 38 cxa_thread_atexit_test_var += 2; 39 } 40 41 #ifdef TEST_FOR_DLCLOSE 42 extern void HelloC(); 43 #endif 44 45 static thread_local A obj; 46 ThreadFunc(void * arg)47extern "C" void ThreadFunc(void *arg) 48 { 49 obj.Test(); 50 #ifdef TEST_FOR_DLCLOSE 51 HelloC(); 52 #endif 53 }