Skip to content

Commit ab58620

Browse files
committed
This should fix #8215: Rare sporadic segfaults in test for core-6142 on windows.
1 parent d9f385e commit ab58620

File tree

1 file changed

+2
-36
lines changed

1 file changed

+2
-36
lines changed

src/common/ThreadStart.h

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,6 @@ inline ThreadId getThreadId()
108108
}
109109

110110

111-
#ifndef USE_POSIX_THREADS
112-
#define USE_FINI_SEM
113-
#endif
114-
115111
template <typename A>
116112
class EmptyThreadSyncCleanup
117113
{
@@ -128,12 +124,7 @@ class ThreadFinishSync
128124
typedef void ThreadRoutine(TA);
129125

130126
ThreadFinishSync(Firebird::MemoryPool& pool, ThreadRoutine* routine, int priority_arg = THREAD_medium)
131-
:
132-
#ifdef USE_FINI_SEM
133-
fini(pool),
134-
#else
135-
threadHandle(0),
136-
#endif
127+
: threadHandle(0),
137128
threadRoutine(routine),
138129
threadPriority(priority_arg),
139130
closing(false)
@@ -142,12 +133,7 @@ class ThreadFinishSync
142133
void run(TA arg)
143134
{
144135
threadArg = arg;
145-
146-
Thread::start(internalRun, this, threadPriority
147-
#ifndef USE_FINI_SEM
148-
, &threadHandle
149-
#endif
150-
);
136+
Thread::start(internalRun, this, threadPriority, &threadHandle);
151137
}
152138

153139
bool tryWait()
@@ -162,24 +148,15 @@ class ThreadFinishSync
162148

163149
void waitForCompletion()
164150
{
165-
#ifdef USE_FINI_SEM
166-
fini.enter();
167-
#else
168151
if (threadHandle)
169152
{
170153
Thread::waitForCompletion(threadHandle);
171154
threadHandle = 0;
172155
}
173-
#endif
174156
}
175157

176158
private:
177-
#ifdef USE_FINI_SEM
178-
Firebird::Semaphore fini;
179-
#else
180159
Thread::Handle threadHandle;
181-
#endif
182-
183160
TA threadArg;
184161
ThreadRoutine* threadRoutine;
185162
int threadPriority;
@@ -202,17 +179,6 @@ class ThreadFinishSync
202179
threadArg->exceptionHandler(ex, threadRoutine);
203180
}
204181

205-
#ifdef USE_FINI_SEM
206-
try
207-
{
208-
fini.release();
209-
}
210-
catch (const Firebird::Exception& ex)
211-
{
212-
threadArg->exceptionHandler(ex, threadRoutine);
213-
}
214-
#endif
215-
216182
Cleanup::cleanup(threadArg);
217183
closing = true;
218184
}

0 commit comments

Comments
 (0)