31 EnterCriticalSection( &m.
impl );
34 __TBB_ASSERT(
false,
"recursive_mutex::scoped_lock: mutex already destroyed");
37 __TBB_ASSERT(
false,
"recursive_mutex::scoped_lock: illegal mutex state");
41 int error_code = pthread_mutex_lock(&m.
impl);
56 __TBB_ASSERT(
false,
"recursive_mutex::scoped_lock: mutex already destroyed");
59 __TBB_ASSERT(
false,
"recursive_mutex::scoped_lock: illegal mutex state");
64 __TBB_ASSERT_EX(!error_code,
"recursive_mutex::scoped_lock: pthread_mutex_unlock failed");
75 __TBB_ASSERT(
false,
"recursive_mutex::scoped_lock: mutex already destroyed");
78 __TBB_ASSERT(
false,
"recursive_mutex::scoped_lock: illegal mutex state");
84 result = TryEnterCriticalSection(&m.
impl)!=0;
86 result = pthread_mutex_trylock(&m.
impl)==0;
95 InitializeCriticalSectionEx(&
impl, 4000, 0);
98 pthread_mutexattr_t mtx_attr;
99 int error_code = pthread_mutexattr_init( &mtx_attr );
103 pthread_mutexattr_settype( &mtx_attr, PTHREAD_MUTEX_RECURSIVE );
104 error_code = pthread_mutex_init( &
impl, &mtx_attr );
107 pthread_mutexattr_destroy( &mtx_attr );
116 DeleteCriticalSection(&
impl);
119 __TBB_ASSERT(
false,
"recursive_mutex: already destroyed");
122 __TBB_ASSERT(
false,
"recursive_mutex: illegal state for destruction");
127 int error_code = pthread_mutex_destroy(&
impl);
128 __TBB_ASSERT_EX(!error_code,
"recursive_mutex: pthread_mutex_destroy failed");
void __TBB_EXPORTED_METHOD internal_construct()
All checks from mutex constructor using mutex.state were moved here.
#define ITT_SYNC_CREATE(obj, type, name)
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...
#define _T(string_literal)
Standard Windows style macro to markup the string literals.
void __TBB_EXPORTED_METHOD internal_destroy()
All checks from mutex destructor using mutex.state were moved here.
bool __TBB_EXPORTED_METHOD internal_try_acquire(recursive_mutex &m)
All checks from try_acquire using mutex.state were moved here.
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
void __TBB_EXPORTED_METHOD internal_release()
All checks from release using mutex.state were moved here.
#define __TBB_ASSERT_EX(predicate, comment)
"Extended" version is useful to suppress warnings if a variable is only used with an assert ...
void __TBB_EXPORTED_METHOD internal_acquire(recursive_mutex &m)
All checks from acquire using mutex.state were moved here.
recursive_mutex * my_mutex
The pointer to the current recursive_mutex to work.
Mutex that allows recursive mutex acquisition.