Skip to content

Commit 178b643

Browse files
fix Windows build by introducing a method to retrieve thread id from crypto thread handle
1 parent 3050002 commit 178b643

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/common/ThreadStart.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@ ThreadId Thread::getId()
219219
#endif
220220
}
221221

222+
ThreadId Thread::getIdFromHandle(Handle threadHandle)
223+
{
224+
return threadHandle;
225+
}
226+
222227
bool Thread::isCurrent(InternalId iid)
223228
{
224229
return pthread_equal(iid, pthread_self());
@@ -368,6 +373,11 @@ ThreadId Thread::getId()
368373
return GetCurrentThreadId();
369374
}
370375

376+
ThreadId Thread::getIdFromHandle(Handle threadHandle)
377+
{
378+
return GetThreadId(threadHandle);
379+
}
380+
371381
bool Thread::isCurrent(InternalId iid)
372382
{
373383
return GetCurrentThreadId() == iid;
@@ -420,6 +430,10 @@ Thread::Handle Thread::getId()
420430
{
421431
}
422432

433+
Thread::Handle Thread::getIdFromHandle(Handle)
434+
{
435+
}
436+
423437
void Thread::sleep(unsigned milliseconds)
424438
{
425439
}

src/common/ThreadStart.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class Thread
8383
static void kill(Handle& handle);
8484

8585
static ThreadId getId();
86+
static ThreadId getIdFromHandle(Handle threadHandle);
8687

8788
static void sleep(unsigned milliseconds);
8889
static void yield();

src/jrd/jrd.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7765,10 +7765,15 @@ void release_attachment(thread_db* tdbb, Jrd::Attachment* attachment, XThreadEns
77657765
XThreadEnsureUnlock* activeThreadGuard = dropGuard;
77667766
if (!activeThreadGuard)
77677767
{
7768-
if (dbb->dbb_crypto_manager && Thread::isCurrent(dbb->dbb_crypto_manager->getCryptThreadHandle()))
7768+
if (dbb->dbb_crypto_manager
7769+
&& Thread::isCurrent(Thread::getIdFromHandle(dbb->dbb_crypto_manager->getCryptThreadHandle())))
7770+
{
77697771
activeThreadGuard = &dummyGuard;
7772+
}
77707773
else
7774+
{
77717775
activeThreadGuard = &threadGuard;
7776+
}
77727777
activeThreadGuard->enter();
77737778
}
77747779

0 commit comments

Comments
 (0)