8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 10:00:38 +01:00

This should fix #8215: Rare sporadic segfaults in test for core-6142 on windows.

This commit is contained in:
AlexPeshkoff 2024-08-16 17:13:43 +03:00
parent d9f385e9fd
commit ab58620506

View File

@ -108,10 +108,6 @@ inline ThreadId getThreadId()
}
#ifndef USE_POSIX_THREADS
#define USE_FINI_SEM
#endif
template <typename A>
class EmptyThreadSyncCleanup
{
@ -128,12 +124,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)
@ -142,12 +133,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()
@ -162,24 +148,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;
@ -202,17 +179,6 @@ private:
threadArg->exceptionHandler(ex, threadRoutine);
}
#ifdef USE_FINI_SEM
try
{
fini.release();
}
catch (const Firebird::Exception& ex)
{
threadArg->exceptionHandler(ex, threadRoutine);
}
#endif
Cleanup::cleanup(threadArg);
closing = true;
}