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

Function lock

src/tinythread/tinythread.h:190–199  ·  view source on GitHub ↗

Lock the mutex. The method will block the calling thread until a lock on the mutex can be obtained. The mutex remains locked until @c unlock() is called. @see lock_guard

Source from the content-addressed store, hash-verified

188 /// be obtained. The mutex remains locked until @c unlock() is called.
189 /// @see lock_guard
190 inline void lock()
191 {
192#if defined(_TTHREAD_WIN32_)
193 EnterCriticalSection(&mHandle);
194 while(mAlreadyLocked) Sleep(1000); // Simulate deadlock...
195 mAlreadyLocked = true;
196#else
197 pthread_mutex_lock(&mHandle);
198#endif
199 }
200
201 /// Try to lock the mutex.
202 /// The method will try to lock the mutex. If it fails, the function will

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected