From fceeaebdbaed9fa5b6612e417e1343059b21358d Mon Sep 17 00:00:00 2001 From: AlexPeshkoff Date: Fri, 16 Aug 2024 17:13:43 +0300 Subject: [PATCH] This should fix #8215: Rare sporadic segfaults in test for core-6142 on windows. --- src/common/ThreadStart.h | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/src/common/ThreadStart.h b/src/common/ThreadStart.h index 7c5ef66953..c962313fd9 100644 --- a/src/common/ThreadStart.h +++ b/src/common/ThreadStart.h @@ -108,10 +108,6 @@ inline ThreadId getThreadId() } -#ifndef USE_POSIX_THREADS -#define USE_FINI_SEM -#endif - template class ThreadFinishSync { @@ -119,12 +115,7 @@ public: typedef void ThreadRoutine(TA); ThreadFinishSync(Firebird::MemoryPool& pool, ThreadRoutine* routine, int priority_arg = THREAD_medium) - : -#ifdef USE_FINI_SEM - fini(pool), -#else - threadHandle(0), -#endif + : threadHandle(0), threadRoutine(routine), threadPriority(priority_arg), closing(false) @@ -133,12 +124,7 @@ public: void run(TA arg) { threadArg = arg; - - Thread::start(internalRun, this, threadPriority -#ifndef USE_FINI_SEM - , &threadHandle -#endif - ); + Thread::start(internalRun, this, threadPriority, &threadHandle); } bool tryWait() @@ -153,24 +139,15 @@ public: void waitForCompletion() { -#ifdef USE_FINI_SEM - fini.enter(); -#else if (threadHandle) { Thread::waitForCompletion(threadHandle); threadHandle = 0; } -#endif } private: -#ifdef USE_FINI_SEM - Firebird::Semaphore fini; -#else Thread::Handle threadHandle; -#endif - TA threadArg; ThreadRoutine* threadRoutine; int threadPriority; @@ -193,17 +170,6 @@ private: threadArg->exceptionHandler(ex, threadRoutine); } -#ifdef USE_FINI_SEM - try - { - fini.release(); - } - catch (const Firebird::Exception& ex) - { - threadArg->exceptionHandler(ex, threadRoutine); - } -#endif - if (cleanup) cleanup(threadArg); closing = true;