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

Function ThreadFunctionTryLock

engine/dlib/src/test/test_mutex.cpp:57–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57static void ThreadFunctionTryLock(void* arg)
58{
59 ThreadArg* a = (ThreadArg*) arg;
60
61 dmMutex::Lock(a->m_Mutex);
62 dmAtomicStore32(&a->m_Value, 0);
63 while(dmAtomicGet32(&a->m_Value) == 0)
64 dmTime::Sleep(10*1000);
65 dmMutex::Unlock(a->m_Mutex);
66 dmAtomicStore32(&a->m_Value, 0);
67}
68
69TEST(Mutex, TryLock)
70{

Callers

nothing calls this directly

Calls 5

dmAtomicStore32Function · 0.85
dmAtomicGet32Function · 0.85
LockFunction · 0.50
SleepFunction · 0.50
UnlockFunction · 0.50

Tested by

no test coverage detected