We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6018294 commit de3fc20Copy full SHA for de3fc20
1 file changed
src/hx/thread/CountingSemaphore.posix.cpp
@@ -70,17 +70,22 @@ bool hx::thread::CountingSemaphore_obj::tryAcquire(Null<double> timeout)
70
t.tv_sec = tv.tv_sec + idelta + idelta2;
71
t.tv_nsec = (long)delta;
72
73
- switch (sem_timedwait(&impl->semaphore, &t))
+ if (0 == sem_timedwait(&impl->semaphore, &t))
74
{
75
- case 0:
76
hx::ExitGCFreeZone();
77
return true;
78
- case ETIMEDOUT:
79
- hx::ExitGCFreeZone();
80
- return false;
81
- default:
+ }
+ else
+ {
82
83
- return hx::Throw(HX_CSTRING("Failed to wait for semaphore"));
+ if (errno == ETIMEDOUT)
+ return false;
84
85
86
87
+ return hx::Throw(HX_CSTRING("Failed to wait for semaphore"));
88
89
}
90
91
0 commit comments