35 class mutex : internal::mutex_copy_deprecated_and_disabled {
39 #if TBB_USE_ASSERT || TBB_USE_THREADING_TOOLS 43 InitializeCriticalSectionEx(&
impl, 4000, 0);
45 int error_code = pthread_mutex_init(&
impl,NULL);
57 DeleteCriticalSection(&
impl);
59 pthread_mutex_destroy(&
impl);
149 EnterCriticalSection(&
impl);
151 int error_code = pthread_mutex_lock(&
impl);
165 return s.internal_try_acquire(*
this);
168 return TryEnterCriticalSection(&
impl)!=0;
170 return pthread_mutex_trylock(&
impl)==0;
181 s.internal_release();
184 LeaveCriticalSection(&
impl);
186 pthread_mutex_unlock(&
impl);
206 CRITICAL_SECTION
impl;
221 void set_state(
state_t to ) { state = to; }
void __TBB_EXPORTED_METHOD internal_acquire(mutex &m)
All checks from acquire using mutex.state were moved here.
native_handle_type native_handle()
static const bool is_recursive_mutex
mutex * my_mutex
The pointer to the current mutex to work.
void const char const char int ITT_FORMAT __itt_group_sync s
void __TBB_EXPORTED_METHOD internal_destroy()
All checks from mutex destructor using mutex.state were moved here.
#define __TBB_EXPORTED_METHOD
The scoped locking pattern.
void __TBB_EXPORTED_METHOD internal_release()
All checks from release using mutex.state were moved here.
static const bool is_fair_mutex
mutex()
Construct unacquired mutex.
Wrapper around the platform's native lock.
Block of space aligned sufficiently to construct an array T with N elements.
~scoped_lock()
Release lock (if lock is held).
bool try_acquire(mutex &mutex)
Try acquire lock on given mutex.
void release()
Release lock.
scoped_lock(mutex &mutex)
Acquire lock on given mutex.
T * begin() const
Pointer to beginning of array.
bool __TBB_EXPORTED_METHOD internal_try_acquire(mutex &m)
All checks from try_acquire using mutex.state were moved here.
scoped_lock()
Construct lock that has not acquired a mutex.
void __TBB_EXPORTED_METHOD internal_construct()
All checks from mutex constructor using mutex.state were moved here.
void acquire(mutex &mutex)
Acquire lock on given mutex.
pthread_mutex_t * native_handle_type
Return native_handle.
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.
bool try_lock()
Try acquiring lock (non-blocking)
static const bool is_rw_mutex
#define __TBB_DEFINE_PROFILING_SET_NAME(sync_object_type)