MCPcopy Create free account
hub / github.com/defold/defold / WaitForAtomicValue

Function WaitForAtomicValue

engine/dlib/src/test/test_job_system.cpp:421–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419};
420
421static bool WaitForAtomicValue(int32_atomic_t* value, int32_t expected, uint64_t timeout)
422{
423 uint64_t stop_time = dmTime::GetMonotonicTime() + timeout;
424 while (dmTime::GetMonotonicTime() < stop_time)
425 {
426 if (dmAtomicGet32(value) == expected)
427 return true;
428 dmTime::Sleep(1000);
429 }
430 return dmAtomicGet32(value) == expected;
431}
432
433static int32_t ProcessFinishedBeforeUpdate(HJobContext ctx, HJob job, void* user_context, void* user_data)
434{

Callers 1

TEST_PFunction · 0.85

Calls 3

dmAtomicGet32Function · 0.85
GetMonotonicTimeFunction · 0.50
SleepFunction · 0.50

Tested by

no test coverage detected