19 #if !defined(__TBB_show_deprecation_message_mutex_H) && defined(__TBB_show_deprecated_header_message)
20 #define __TBB_show_deprecation_message_mutex_H
21 #pragma message("TBB Warning: tbb/mutex.h is deprecated. For details, please see Deprecated Features appendix in the TBB reference manual.")
24 #if defined(__TBB_show_deprecated_header_message)
25 #undef __TBB_show_deprecated_header_message
31 #define __TBB_mutex_H_include_area
53 #if TBB_USE_ASSERT || TBB_USE_THREADING_TOOLS
57 InitializeCriticalSectionEx(&
impl, 4000, 0);
59 int error_code = pthread_mutex_init(&
impl,NULL);
71 DeleteCriticalSection(&
impl);
73 pthread_mutex_destroy(&
impl);
104 internal_acquire(mutex);
114 return internal_try_acquire (mutex);
116 bool result = mutex.try_lock();
159 aligned_space<scoped_lock> tmp;
163 EnterCriticalSection(&
impl);
165 int error_code = pthread_mutex_lock(&
impl);
176 aligned_space<scoped_lock> tmp;
179 return s.internal_try_acquire(*
this);
182 return TryEnterCriticalSection(&
impl)!=0;
184 return pthread_mutex_trylock(&
impl)==0;
192 aligned_space<scoped_lock> tmp;
195 s.internal_release();
198 LeaveCriticalSection(&
impl);
200 pthread_mutex_unlock(&
impl);
220 CRITICAL_SECTION
impl;
235 void set_state(
state_t to ) { state = to; }
244 #undef __TBB_mutex_H_include_area
bool try_acquire(mutex &mutex)
Try acquire lock on given mutex.
void const char const char int ITT_FORMAT __itt_group_sync s
scoped_lock(mutex &mutex)
Acquire lock on given mutex.
The scoped lock pattern for write locks.
static const bool is_recursive_mutex
Base class for types that should not be copied or assigned.
native_handle_type native_handle()
void release()
Release lock.
#define __TBB_DEFINE_PROFILING_SET_NAME(sync_object_type)
static const bool is_rw_mutex
void acquire(mutex &mutex)
Acquire lock on given mutex.
class __TBB_DEPRECATED_IN_VERBOSE_MODE_MSG("tbb::aligned_space is deprecated, use std::aligned_storage") aligned_space
Block of space aligned sufficiently to construct an array T with N elements.
scoped_lock()
Construct lock that has not acquired a mutex.
mutex * my_mutex
The pointer to the current mutex to work.
void __TBB_EXPORTED_METHOD internal_construct()
All checks from mutex constructor using mutex.state were moved here.
void __TBB_EXPORTED_METHOD internal_destroy()
All checks from mutex destructor using mutex.state were moved here.
~scoped_lock()
Release lock (if lock is held).
static const bool is_fair_mutex
#define __TBB_EXPORTED_METHOD
pthread_mutex_t * native_handle_type
Return native_handle.
bool try_lock()
Try acquiring lock (non-blocking)
The scoped locking pattern.
void __TBB_EXPORTED_FUNC handle_perror(int error_code, const char *aux_info)
Throws std::runtime_error with what() returning error_code description prefixed with aux_info...
void unlock()
Release lock.