Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Synchronization

Classes

class  tbb::null_mutex
 A mutex which does nothing. More...
 
class  tbb::null_rw_mutex
 A rw mutex which does nothing. More...
 
class  tbb::queuing_mutex
 Queuing mutex with local-only spinning. More...
 
class  tbb::queuing_rw_mutex
 Queuing reader-writer mutex with local-only spinning. More...
 
class  tbb::spin_mutex
 A lock that occupies a single byte. More...
 
class  tbb::spin_rw_mutex_v3
 Fast, unfair, spinning reader-writer lock with backoff and writer-preference. More...
 

Typedefs

typedef
interface7::internal::padded_mutex
< spin_mutex, false > 
tbb::speculative_spin_mutex
 A cross-platform spin mutex with speculative lock acquisition. More...
 
typedef
interface7::internal::padded_mutex
< tbb::spin_rw_mutex, true > 
tbb::interface8::speculative_spin_rw_mutex
 A cross-platform spin reader/writer mutex with speculative lock acquisition. More...
 

Functions

template<typename T >
struct tbb::__TBB_DEPRECATED_IN_VERBOSE_MODE_MSG ("tbb::atomic is deprecated, use std::atomic") atomic
 Primary template for atomic. More...
 
class tbb::__TBB_DEPRECATED_IN_VERBOSE_MODE_MSG ("tbb::critical_section is deprecated, use std::mutex") mutex
 Wrapper around the platform's native lock. More...
 
class tbb::__TBB_DEPRECATED_IN_VERBOSE_MODE_MSG ("tbb::recursive_mutex is deprecated, use std::recursive_mutex") recursive_mutex
 Mutex that allows recursive mutex acquisition. More...
 

Variables

class friend class("tbb::reader_writer_lock
is deprecated, use
std::shared_mutex")
reader_writer_lock 
tbb::interface5::scoped_lock_read
 Writer-preference reader-writer lock with local-only spinning on readers. More...
 

Detailed Description

Typedef Documentation

typedef interface7::internal::padded_mutex<spin_mutex,false> tbb::speculative_spin_mutex

A cross-platform spin mutex with speculative lock acquisition.

On platforms with proper HW support, this lock may speculatively execute its critical sections, using HW mechanisms to detect real data races and ensure atomicity of the critical sections. In particular, it uses Intel(R) Transactional Synchronization Extensions (Intel(R) TSX). Without such HW support, it behaves like a spin_mutex. It should be used for locking short critical sections where the lock is contended but the data it protects are not. If zero-initialized, the mutex is considered unheld.

Definition at line 205 of file spin_mutex.h.

typedef interface7::internal::padded_mutex<tbb::spin_rw_mutex,true> tbb::interface8::speculative_spin_rw_mutex

A cross-platform spin reader/writer mutex with speculative lock acquisition.

On platforms with proper HW support, this lock may speculatively execute its critical sections, using HW mechanisms to detect real data races and ensure atomicity of the critical sections. In particular, it uses Intel(R) Transactional Synchronization Extensions (Intel(R) TSX). Without such HW support, it behaves like a spin_rw_mutex. It should be used for locking short critical sections where the lock is contended but the data it protects are not.

Definition at line 245 of file spin_rw_mutex.h.

Function Documentation

class tbb::__TBB_DEPRECATED_IN_VERBOSE_MODE_MSG ( "tbb::recursive_mutex is  deprecated,
use std::recursive_mutex"   
)

Mutex that allows recursive mutex acquisition.

Mutex that allows recursive mutex acquisition.

Definition at line 49 of file recursive_mutex.h.

References tbb::internal::handle_perror(), tbb::impl, and tbb::internal_construct().

50  : internal::mutex_copy_deprecated_and_disabled {
51 public:
53  recursive_mutex() {
54 #if TBB_USE_ASSERT || TBB_USE_THREADING_TOOLS
56 #else
57  #if _WIN32||_WIN64
58  InitializeCriticalSectionEx(&impl, 4000, 0);
59  #else
60  pthread_mutexattr_t mtx_attr;
61  int error_code = pthread_mutexattr_init( &mtx_attr );
62  if( error_code )
63  tbb::internal::handle_perror(error_code,"recursive_mutex: pthread_mutexattr_init failed");
64 
65  pthread_mutexattr_settype( &mtx_attr, PTHREAD_MUTEX_RECURSIVE );
66  error_code = pthread_mutex_init( &impl, &mtx_attr );
67  if( error_code )
68  tbb::internal::handle_perror(error_code,"recursive_mutex: pthread_mutex_init failed");
69 
70  pthread_mutexattr_destroy( &mtx_attr );
71  #endif /* _WIN32||_WIN64*/
72 #endif /* TBB_USE_ASSERT */
73  };
void __TBB_EXPORTED_METHOD internal_construct()
All checks from mutex constructor using mutex.state were moved here.
pthread_mutex_t impl
Definition: mutex.h:223
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...
Definition: tbb_misc.cpp:87

Here is the call graph for this function:

template<typename T >
struct tbb::__TBB_DEPRECATED_IN_VERBOSE_MODE_MSG ( "tbb::atomic is  deprecated,
use std::atomic"   
)

Primary template for atomic.

Specialization for atomic<T*> with arithmetic and operator->.

See the Reference for details.

Definition at line 417 of file atomic.h.

418  : internal::atomic_impl<T> {
419 #if __TBB_ATOMIC_CTORS
420  atomic() = default;
421  constexpr atomic(T arg): internal::atomic_impl<T>(arg) {}
422  constexpr atomic<T>(const atomic<T>& rhs): internal::atomic_impl<T>(rhs) {}
423 #endif
424  T operator=( T rhs ) {
425  // "this" required here in strict ISO C++ because store_with_release is a dependent name
426  return this->store_with_release(rhs);
427  }
428  atomic<T>& operator=( const atomic<T>& rhs ) {this->store_with_release(rhs); return *this;}
429 };
class tbb::__TBB_DEPRECATED_IN_VERBOSE_MODE_MSG ( "tbb::critical_section is  deprecated,
use std::mutex"   
)

Wrapper around the platform's native lock.

Definition at line 49 of file mutex.h.

References tbb::internal::handle_perror(), tbb::impl, and tbb::internal_construct().

49  : internal::mutex_copy_deprecated_and_disabled {
50 public:
52  mutex() {
53 #if TBB_USE_ASSERT || TBB_USE_THREADING_TOOLS
55 #else
56  #if _WIN32||_WIN64
57  InitializeCriticalSectionEx(&impl, 4000, 0);
58  #else
59  int error_code = pthread_mutex_init(&impl,NULL);
60  if( error_code )
61  tbb::internal::handle_perror(error_code,"mutex: pthread_mutex_init failed");
62  #endif /* _WIN32||_WIN64*/
63 #endif /* TBB_USE_ASSERT */
64  };
void __TBB_EXPORTED_METHOD internal_construct()
All checks from mutex constructor using mutex.state were moved here.
pthread_mutex_t impl
Definition: mutex.h:223
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...
Definition: tbb_misc.cpp:87

Here is the call graph for this function:

Variable Documentation

class friend class ("tbb::reader_writer_lock is deprecated, use std::shared_mutex") reader_writer_lock tbb::interface5::scoped_lock_read

Writer-preference reader-writer lock with local-only spinning on readers.

Loosely adapted from Mellor-Crummey and Scott pseudocode at http://www.cs.rochester.edu/research/synchronization/pseudocode/rw.html#s_wp

Definition at line 44 of file reader_writer_lock.h.


Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.