MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / try_lock

Method try_lock

src/tinythread/tinythread.h:296–303  ·  view source on GitHub ↗

Try to lock the mutex. The method will try to lock the mutex. If it fails, the function will return immediately (non-blocking). @return @c true if the lock was acquired, or @c false if the lock could not be acquired.

Source from the content-addressed store, hash-verified

294 /// @return @c true if the lock was acquired, or @c false if the lock could
295 /// not be acquired.
296 inline bool try_lock()
297 {
298#if defined(_TTHREAD_WIN32_)
299 return TryEnterCriticalSection(&mHandle) ? true : false;
300#else
301 return (pthread_mutex_trylock(&mHandle) == 0) ? true : false;
302#endif
303 }
304
305 /// Unlock the mutex.
306 /// If any threads are waiting for the lock on this mutex, one of them will

Callers 1

readyMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected