MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / Wait

Method Wait

src/hx/Thread.cpp:332–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330 }
331 }
332 bool Wait(double inTimeout)
333 {
334 double stop = 0;
335 if (inTimeout>=0)
336 stop = Now() + inTimeout;
337 while(1)
338 {
339 mAvailableLock.Lock();
340 if (mAvailable)
341 {
342 --mAvailable;
343 if (mAvailable>0)
344 mNotEmpty.Set();
345 mAvailableLock.Unlock();
346 return true;
347 }
348 mAvailableLock.Unlock();
349 double wait = 0;
350 if (inTimeout>=0)
351 {
352 wait = stop-Now();
353 if (wait<=0)
354 return false;
355 }
356
357 hx::EnterGCFreeZone();
358 if (inTimeout<0)
359 mNotEmpty.Wait( );
360 else
361 mNotEmpty.WaitSeconds(wait);
362 hx::ExitGCFreeZone();
363 }
364 }
365 void Release()
366 {
367 AutoLock lock(mAvailableLock);

Callers 5

PopFrontMethod · 0.45
__hxcpp_lock_waitFunction · 0.45
DoBreakMethod · 0.45
PauseForCollectMethod · 0.45
WaitForSafeMethod · 0.45

Calls 6

EnterGCFreeZoneFunction · 0.85
ExitGCFreeZoneFunction · 0.85
WaitSecondsMethod · 0.80
LockMethod · 0.45
SetMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected