21 #ifndef __TBB_recursive_mutex_H 22 #define __TBB_recursive_mutex_H 43 #if TBB_USE_ASSERT || TBB_USE_THREADING_TOOLS 47 InitializeCriticalSectionEx(&
impl, 4000, 0);
49 pthread_mutexattr_t mtx_attr;
50 int error_code = pthread_mutexattr_init( &mtx_attr );
54 pthread_mutexattr_settype( &mtx_attr, PTHREAD_MUTEX_RECURSIVE );
55 error_code = pthread_mutex_init( &
impl, &mtx_attr );
59 pthread_mutexattr_destroy( &mtx_attr );
69 DeleteCriticalSection(&
impl);
71 pthread_mutex_destroy(&
impl);
164 EnterCriticalSection(&
impl);
166 int error_code = pthread_mutex_lock(&
impl);
181 return TryEnterCriticalSection(&
impl)!=0;
183 return pthread_mutex_trylock(&
impl)==0;
194 s.internal_release();
197 LeaveCriticalSection(&
impl);
199 pthread_mutex_unlock(&
impl);
214 CRITICAL_SECTION
impl;
static const bool is_rw_mutex
void __TBB_EXPORTED_METHOD internal_destroy()
All checks from mutex destructor using mutex.state were moved here.
T * begin() const
Pointer to beginning of array.
static const bool is_fair_mutex
static const bool is_recursive_mutex
scoped_lock()
Construct lock that has not acquired a recursive_mutex.
The scoped locking pattern.
native_handle_type native_handle()
recursive_mutex()
Construct unacquired recursive_mutex.
void __TBB_EXPORTED_METHOD internal_construct()
All checks from mutex constructor using mutex.state were moved here.
void __TBB_EXPORTED_METHOD internal_acquire(recursive_mutex &m)
All checks from acquire using mutex.state were moved here.
Mutex that allows recursive mutex acquisition.
void unlock()
Release lock.
void __TBB_EXPORTED_METHOD internal_release()
All checks from release using mutex.state were moved here.
#define __TBB_EXPORTED_METHOD
bool try_lock()
Try acquiring lock (non-blocking)
scoped_lock(recursive_mutex &mutex)
Acquire lock on given mutex.
bool try_lock()
Try acquiring lock (non-blocking)
#define __TBB_DEFINE_PROFILING_SET_NAME(sync_object_type)
void release()
Release lock.
pthread_mutex_t * native_handle_type
Return native_handle.
recursive_mutex * my_mutex
The pointer to the current recursive_mutex to work.
bool try_acquire(recursive_mutex &mutex)
Try acquire lock on given recursive_mutex.
~scoped_lock()
Release lock (if lock is held).
void const char const char int ITT_FORMAT __itt_group_sync s
bool __TBB_EXPORTED_METHOD internal_try_acquire(recursive_mutex &m)
All checks from try_acquire using mutex.state were moved here.
Wrapper around the platform's native lock.
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.
Block of space aligned sufficiently to construct an array T with N elements.
void acquire(recursive_mutex &mutex)
Acquire lock on given mutex.