MCPcopy Create free account
hub / github.com/crownengine/crown / wait

Method wait

src/core/thread/semaphore.cpp:88–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88void Semaphore::wait()
89{
90#if CROWN_PLATFORM_WINDOWS
91 DWORD err = WaitForSingleObject(_priv->handle, INFINITE);
92 CE_ASSERT(err == WAIT_OBJECT_0, "WaitForSingleObject: GetLastError = %d", GetLastError());
93 CE_UNUSED(err);
94#else
95 pthread_mutex_lock(&_priv->mutex);
96 while (_priv->count <= 0) {
97 int err = pthread_cond_wait(&_priv->cond, &_priv->mutex);
98 CE_ASSERT(err == 0, "pthread_cond_wait: errno = %d", err);
99 CE_UNUSED(err);
100 }
101 _priv->count--;
102 pthread_mutex_unlock(&_priv->mutex);
103#endif
104}
105
106bool Semaphore::try_wait()
107{

Callers 2

addr2lineFunction · 0.45
startMethod · 0.45

Calls 2

pthread_mutex_lockFunction · 0.85
pthread_mutex_unlockFunction · 0.85

Tested by

no test coverage detected