File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,17 +70,22 @@ bool hx::thread::CountingSemaphore_obj::tryAcquire(Null<double> timeout)
7070 t.tv_sec = tv.tv_sec + idelta + idelta2;
7171 t.tv_nsec = (long )delta;
7272
73- switch ( sem_timedwait (&impl->semaphore , &t))
73+ if ( 0 == sem_timedwait (&impl->semaphore , &t))
7474 {
75- case 0 :
7675 hx::ExitGCFreeZone ();
7776 return true ;
78- case ETIMEDOUT:
79- hx::ExitGCFreeZone ();
80- return false ;
81- default :
77+ }
78+ else
79+ {
8280 hx::ExitGCFreeZone ();
83- return hx::Throw (HX_CSTRING (" Failed to wait for semaphore" ));
81+ if (errno == ETIMEDOUT)
82+ {
83+ return false ;
84+ }
85+ else
86+ {
87+ return hx::Throw (HX_CSTRING (" Failed to wait for semaphore" ));
88+ }
8489 }
8590 }
8691}
Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ void hx::thread::CountingSemaphore_obj::acquire()
3434 hx::ExitGCFreeZone ();
3535 hx::Throw (HX_CSTRING (" Failed to wait for semaphore" ));
3636 }
37+
38+ hx::ExitGCFreeZone ();
3739}
3840
3941void hx::thread::CountingSemaphore_obj::release ()
You can’t perform that action at this time.
0 commit comments