Try acquiring lock (non-blocking) Return true if lock acquired; false otherwise. */
| 173 | //! Try acquiring lock (non-blocking) |
| 174 | /** Return true if lock acquired; false otherwise. */ |
| 175 | bool try_lock() { |
| 176 | #if TBB_USE_ASSERT |
| 177 | aligned_space<scoped_lock> tmp; |
| 178 | return (new(tmp.begin()) scoped_lock)->internal_try_acquire(*this); |
| 179 | #else |
| 180 | #if _WIN32||_WIN64 |
| 181 | return TryEnterCriticalSection(&impl)!=0; |
| 182 | #else |
| 183 | return pthread_mutex_trylock(&impl)==0; |
| 184 | #endif /* _WIN32||_WIN64 */ |
| 185 | #endif /* TBB_USE_ASSERT */ |
| 186 | } |
| 187 | |
| 188 | //! Release lock |
| 189 | void unlock() { |
no test coverage detected