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.
| 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 |