Skip to content

Commit 2bd564f

Browse files
author
Aidan Lee
committed
Fix some gc zone mismatches
1 parent 4f84ea8 commit 2bd564f

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/hx/thread/CountingSemaphore.apple.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,15 @@ hx::thread::CountingSemaphore_obj::CountingSemaphore_obj(int value) : impl(new I
2121

2222
void hx::thread::CountingSemaphore_obj::acquire()
2323
{
24-
hx::AutoGCFreeZone zone;
24+
hx::EnterGCFreeZone();
2525

2626
if (0 != dispatch_semaphore_wait(impl->semaphore, DISPATCH_TIME_FOREVER))
2727
{
28+
hx::ExitGCFreeZone();
2829
hx::Throw(HX_CSTRING("Failed to wait for semaphore"));
2930
}
31+
32+
hx::ExitGCFreeZone();
3033
}
3134

3235
void hx::thread::CountingSemaphore_obj::release()

src/hx/thread/CountingSemaphore.posix.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ void hx::thread::CountingSemaphore_obj::acquire()
3232

3333
if (0 != sem_wait(&impl->semaphore))
3434
{
35+
hx::ExitGCFreeZone();
3536
hx::Throw(HX_CSTRING("Failed to wait on semaphore"));
3637
}
3738

src/hx/thread/CountingSemaphore.win32.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ hx::thread::CountingSemaphore_obj::CountingSemaphore_obj(int value) : impl(new I
2727

2828
void hx::thread::CountingSemaphore_obj::acquire()
2929
{
30-
hx::AutoGCFreeZone zone;
30+
hx::EnterGCFreeZone();
3131

3232
if (NO_ERROR != WaitForSingleObject(impl->semaphore, INFINITE))
3333
{
34+
hx::ExitGCFreeZone();
3435
hx::Throw(HX_CSTRING("Failed to wait for semaphore"));
3536
}
3637
}

0 commit comments

Comments
 (0)