Test.cpp revision 296373
1/* $FreeBSD: releng/10.3/tools/regression/pthread/unwind/Test.cpp 213155 2010-09-25 04:26:40Z davidxu $ */ 2 3int destructed; 4int destructed2; 5 6class Test { 7public: 8 Test() { printf("Test::Test()\n"); } 9 ~Test() { printf("Test::~Test()\n"); destructed = 1; } 10}; 11 12void 13cleanup_handler(void *arg) 14{ 15 destructed2 = 1; 16 printf("%s()\n", __func__); 17} 18 19void 20check_destruct(void) 21{ 22 if (!destructed) 23 printf("Bug, object destructor is not called\n"); 24 else 25 printf("OK\n"); 26} 27 28void 29check_destruct2(void) 30{ 31 if (!destructed) 32 printf("Bug, object destructor is not called\n"); 33 else if (!destructed2) 34 printf("Bug, cleanup handler is not called\n"); 35 else 36 printf("OK\n"); 37} 38