19 #if !defined(__TBB_show_deprecation_message_recursive_mutex_H) && defined(__TBB_show_deprecated_header_message) 20 #define __TBB_show_deprecation_message_recursive_mutex_H 21 #pragma message("TBB Warning: tbb/recursive_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 28 #ifndef __TBB_recursive_mutex_H 29 #define __TBB_recursive_mutex_H 31 #define __TBB_recursive_mutex_H_include_area 50 recursive_mutex : internal::mutex_copy_deprecated_and_disabled {
54 #if TBB_USE_ASSERT || TBB_USE_THREADING_TOOLS 58 InitializeCriticalSectionEx(&impl, 4000, 0);
60 pthread_mutexattr_t mtx_attr;
61 int error_code = pthread_mutexattr_init( &mtx_attr );
65 pthread_mutexattr_settype( &mtx_attr, PTHREAD_MUTEX_RECURSIVE );
66 error_code = pthread_mutex_init( &impl, &mtx_attr );
70 pthread_mutexattr_destroy( &mtx_attr );
80 DeleteCriticalSection(&impl);
82 pthread_mutex_destroy(&impl);
89 friend class scoped_lock;
94 class scoped_lock: internal::no_copy {
97 scoped_lock() : my_mutex(NULL) {};
100 scoped_lock( recursive_mutex& mutex ) {
114 void acquire( recursive_mutex& mutex ) {
116 internal_acquire( mutex );
124 bool try_acquire( recursive_mutex& mutex ) {
126 return internal_try_acquire( mutex );
128 bool result = mutex.try_lock();
147 recursive_mutex* my_mutex;
158 friend class recursive_mutex;
162 static const bool is_rw_mutex =
false;
163 static const bool is_recursive_mutex =
true;
164 static const bool is_fair_mutex =
false;
171 aligned_space<scoped_lock> tmp;
172 new(tmp.begin()) scoped_lock(*
this);
175 EnterCriticalSection(&impl);
177 int error_code = pthread_mutex_lock(&impl);
188 aligned_space<scoped_lock> tmp;
189 return (
new(tmp.begin()) scoped_lock)->internal_try_acquire(*
this);
192 return TryEnterCriticalSection(&impl)!=0;
194 return pthread_mutex_trylock(&impl)==0;
202 aligned_space<scoped_lock> tmp;
203 scoped_lock&
s = *tmp.begin();
205 s.internal_release();
208 LeaveCriticalSection(&impl);
210 pthread_mutex_unlock(&impl);
217 typedef LPCRITICAL_SECTION native_handle_type;
219 typedef pthread_mutex_t* native_handle_type;
221 native_handle_type native_handle() {
return (native_handle_type) &impl; }
225 CRITICAL_SECTION impl;
231 pthread_mutex_t impl;
246 #undef __TBB_recursive_mutex_H_include_area 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.
#define __TBB_DEFINE_PROFILING_SET_NAME(sync_object_type)
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 const char const char int ITT_FORMAT __itt_group_sync s
#define __TBB_EXPORTED_METHOD
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void * lock