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
| 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 |
nothing calls this directly
no outgoing calls
no test coverage detected