MCPcopy Create free account
hub / github.com/cameron314/concurrentqueue / try_lock

Method try_lock

benchmarks/tbb/recursive_mutex.h:175–186  ·  view source on GitHub ↗

Try acquiring lock (non-blocking) Return true if lock acquired; false otherwise. */

Source from the content-addressed store, hash-verified

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() {

Callers 1

try_acquireMethod · 0.45

Calls 2

internal_try_acquireMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected