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