21 #ifndef __TBB__x86_eliding_mutex_impl_H 22 #define __TBB__x86_eliding_mutex_impl_H 24 #ifndef __TBB_spin_mutex_H 25 #error Do not #include this internal file directly; use public TBB headers instead. 28 #if ( __TBB_x86_32 || __TBB_x86_64 ) 31 namespace interface7 {
34 template<
typename Mutex,
bool is_rw>
44 class x86_eliding_mutex : tbb::internal::mutex_copy_deprecated_and_disabled {
46 __TBB_atomic_flag flag;
48 friend class padded_mutex<x86_eliding_mutex, false>;
53 x86_eliding_mutex() : flag(0) {}
57 #if __TBB_USE_X86_ELIDING_MUTEX || __TBB_GCC_VERSION < 40000 66 class scoped_lock : tbb::internal::no_copy {
69 x86_eliding_mutex* my_mutex;
73 scoped_lock() : my_mutex(NULL) {}
76 scoped_lock( x86_eliding_mutex& m ) : my_mutex(NULL) {
acquire(m); }
79 void acquire( x86_eliding_mutex& m ) {
80 __TBB_ASSERT( !my_mutex,
"already holding a lock" );
88 bool try_acquire( x86_eliding_mutex& m ) {
89 __TBB_ASSERT( !my_mutex,
"already holding a lock" );
91 bool result = m.try_lock();
100 __TBB_ASSERT( my_mutex,
"release on scoped_lock that is not holding a lock" );
113 #if __TBB_USE_X86_ELIDING_MUTEX || __TBB_GCC_VERSION < 40000 119 static const bool is_rw_mutex =
false;
120 static const bool is_recursive_mutex =
false;
121 static const bool is_fair_mutex =
false;
127 __TBB_LockByteElided(flag);
133 return __TBB_TryLockByteElided(flag);
138 __TBB_UnlockByteElided( flag );
Acquire.
Definition: atomic.h:47
Definition: _flow_graph_async_msg_impl.h:32
Release.
Definition: atomic.h:49
The namespace tbb contains all components of the library.
Definition: parallel_for.h:44