|
Intel(R) Threading Building Blocks Doxygen Documentation
version 4.2.3
|
Namespaces | |
| internal | |
Classes | |
| class | concurrent_hash_map |
| Unordered map from Key to T. More... | |
| class | concurrent_priority_queue |
| Concurrent priority queue. More... | |
| class | concurrent_unordered_map_traits |
| class | concurrent_unordered_multimap |
| class | concurrent_unordered_map |
| class | concurrent_unordered_set_traits |
| class | concurrent_unordered_multiset |
| class | concurrent_unordered_set |
| class | scoped_lock |
| The scoped lock pattern for write locks. More... | |
| class | scoped_lock_read |
| The scoped lock pattern for read locks. More... | |
Enumerations | |
| enum | status_t { waiting_nonblocking, waiting, active, invalid } |
| Status type for nodes associated with lock instances. More... | |
Functions | |
| template<typename T > | |
| __TBB_DEPRECATED_MSG ("tbb::tbb_hasher is deprecated, use std::hash") inline size_t tbb_hasher(const T &t) | |
| Hasher functions. More... | |
| template<typename E , typename S , typename A > | |
| __TBB_DEPRECATED_MSG ("tbb::tbb_hasher is deprecated, use std::hash") inline size_t tbb_hasher(const std | |
| template<typename F , typename S > | |
| __TBB_DEPRECATED_MSG ("tbb::tbb_hasher is deprecated, use std::hash") inline size_t tbb_hasher(const std | |
| reader_writer_lock () | |
| Constructs a new reader_writer_lock. More... | |
| ~reader_writer_lock () | |
| Destructs a reader_writer_lock object. More... | |
| void __TBB_EXPORTED_METHOD | lock () |
| Acquires the reader_writer_lock for write. More... | |
| bool __TBB_EXPORTED_METHOD | try_lock () |
| Tries to acquire the reader_writer_lock for write. More... | |
| void __TBB_EXPORTED_METHOD | lock_read () |
| Acquires the reader_writer_lock for read. More... | |
| bool __TBB_EXPORTED_METHOD | try_lock_read () |
| Tries to acquire the reader_writer_lock for read. More... | |
| void __TBB_EXPORTED_METHOD | unlock () |
| Releases the reader_writer_lock. More... | |
| void __TBB_EXPORTED_METHOD | internal_construct () |
| void __TBB_EXPORTED_METHOD | internal_destroy () |
| bool | start_write (scoped_lock *) |
| Attempts to acquire write lock. More... | |
| void | set_next_writer (scoped_lock *w) |
| Sets writer_head to w and attempts to unblock. More... | |
| void | end_write (scoped_lock *) |
| Relinquishes write lock to next waiting writer or group of readers. More... | |
| bool | is_current_writer () |
| Checks if current thread holds write lock. More... | |
| void | start_read (scoped_lock_read *) |
| Attempts to acquire read lock. More... | |
| void | unblock_readers () |
| Unblocks pending readers. More... | |
| void | end_read () |
| Relinquishes read lock by decrementing counter; last reader wakes pending writer. More... | |
| uintptr_t | fetch_and_or (atomic< uintptr_t > &operand, uintptr_t value) |
| uintptr_t | fetch_and_and (atomic< uintptr_t > &operand, uintptr_t value) |
| template<typename T , typename U > | |
| void | spin_wait_while_geq (const volatile T &location, U value) |
| Spin WHILE the value at the location is greater than or equal to a given value. More... | |
| template<typename T , typename U > | |
| void | spin_wait_until_and (const volatile T &location, U value) |
| Spin UNTIL (location & value) is true. More... | |
Variables | |
| class friend class("tbb::reader_writer_lock is deprecated, use std::shared_mutex") reader_writer_lock | scoped_lock_read |
| Writer-preference reader-writer lock with local-only spinning on readers. More... | |
| atomic< scoped_lock_read * > | reader_head |
| The list of pending readers. More... | |
| atomic< scoped_lock * > | writer_head |
| The list of pending writers. More... | |
| atomic< scoped_lock * > | writer_tail |
| The last node in the list of pending writers. More... | |
| tbb_thread::id | my_current_writer |
| Writer that owns the mutex; tbb_thread::id() otherwise. More... | |
| atomic< uintptr_t > | rdr_count_and_flags |
| Status of mutex. More... | |
| const uintptr_t | WFLAG1 = 0x1 |
| const uintptr_t | WFLAG2 = 0x2 |
| const uintptr_t | RFLAG = 0x4 |
| const uintptr_t | RC_INCR = 0x8 |
Status type for nodes associated with lock instances.
waiting_nonblocking: the wait state for nonblocking lock instances; for writes, these transition straight to active states; for reads, these are unused.
waiting: the start and spin state for all lock instances; these will transition to active state when appropriate. Non-blocking write locks transition from this state to waiting_nonblocking immediately.
active: the active state means that the lock instance holds the lock; it will transition to invalid state during node deletion
invalid: the end state for all nodes; this is set in the destructor so if we encounter this state, we are looking at memory that has already been freed
The state diagrams below describe the status transitions. Single arrows indicate that the thread that owns the node is responsible for the transition; double arrows indicate that any thread could make the transition.
State diagram for scoped_lock status:
waiting -------—> waiting_nonblocking | _____________/ | V V V active --------------—> invalid
State diagram for scoped_lock_read status:
waiting | V active --------------—>invalid
| Enumerator | |
|---|---|
| waiting_nonblocking | |
| waiting | |
| active | |
| invalid | |
Definition at line 85 of file reader_writer_lock.h.
| tbb::interface5::__TBB_DEPRECATED_MSG | ( | "tbb::tbb_hasher is | deprecated, |
| use std::hash" | |||
| ) | const |
Hasher functions.
Definition at line 61 of file _tbb_hash_compare_impl.h.
References tbb::interface5::internal::hash_multiplier.
| tbb::interface5::__TBB_DEPRECATED_MSG | ( | "tbb::tbb_hasher is | deprecated, |
| use std::hash" | |||
| ) | const |
Definition at line 70 of file _tbb_hash_compare_impl.h.
References h, and tbb::interface5::internal::hash_multiplier.
| tbb::interface5::__TBB_DEPRECATED_MSG | ( | "tbb::tbb_hasher is | deprecated, |
| use std::hash" | |||
| ) | const |
Definition at line 77 of file _tbb_hash_compare_impl.h.
|
private |
Relinquishes read lock by decrementing counter; last reader wakes pending writer.
Definition at line 282 of file reader_writer_lock.cpp.
References __TBB_ASSERT, ITT_NOTIFY, RC_INCR, rdr_count_and_flags, and sync_releasing.
|
private |
Relinquishes write lock to next waiting writer or group of readers.
Definition at line 260 of file reader_writer_lock.cpp.
References __TBB_ASSERT, active, fetch_and_and(), id, ITT_NOTIFY, my_current_writer, tbb::interface5::scoped_lock::next, rdr_count_and_flags, RFLAG, set_next_writer(), tbb::internal::spin_wait_while_eq(), sync_releasing, unblock_readers(), WFLAG1, WFLAG2, writer_head, and writer_tail.
|
inline |
Definition at line 46 of file reader_writer_lock.cpp.
References tbb::internal::atomic_backoff::pause().
Referenced by end_write().
|
inline |
Definition at line 37 of file reader_writer_lock.cpp.
References tbb::internal::atomic_backoff::pause().
Referenced by set_next_writer(), and start_read().
|
private |
Referenced by reader_writer_lock(), tbb::interface5::scoped_lock::scoped_lock(), and tbb::interface5::scoped_lock_read::scoped_lock_read().
|
private |
Referenced by ~reader_writer_lock(), tbb::interface5::scoped_lock::~scoped_lock(), and tbb::interface5::scoped_lock_read::~scoped_lock_read().
|
inlineprivate |
Checks if current thread holds write lock.
Definition at line 288 of file reader_writer_lock.cpp.
References tbb::this_tbb_thread::get_id(), and my_current_writer.
| void __TBB_EXPORTED_METHOD tbb::interface5::lock | ( | ) |
Acquires the reader_writer_lock for write.
If the lock is currently held in write mode by another context, the writer will block by spinning on a local variable. Exceptions thrown: improper_lock The context tries to acquire a reader_writer_lock that it already has write ownership of.
Acquires the reader_writer_lock for write.
Definition at line 157 of file mutex.h.
References tbb::internal::handle_perror(), tbb::impl, and tbb::scoped_lock.
Referenced by tbb::flow::interface11::source_node< Output >::activate(), tbb::internal::market::arena_in_need(), tbb::internal::generic_scheduler::cleanup_master(), tbb::internal::market::create_arena(), tbb::internal::generic_scheduler::create_master(), tbb::flow::interface11::limiter_node< T, U >::decrement_counter(), tbb::internal::task_stream< num_priority_levels >::drain(), tbb::flow::interface11::limiter_node< T, U >::forward_task(), tbb::internal::market::global_market(), tbb::internal::input_buffer::has_item(), tbb::flow::interface11::internal::join_node_FE< queueing, InputTuple, OutputTuple >::increment_port_count(), tbb::flow::interface11::opencl_factory< default_device_filter >::init(), tbb::flow::interface11::opencl_factory< default_device_filter >::init_once(), tbb::interface9::global_control::internal_create(), tbb::interface9::global_control::internal_destroy(), tbb::interface5::concurrent_hash_map< Key, T, HashCompare, A >::internal_fast_find(), tbb::strict_ppl::internal::micro_queue< T >::invalidate_page_and_rethrow(), tbb::internal::msvc_inline_asm::lock_and(), tbb::internal::msvc_inline_asm::lock_or(), tbb::internal::micro_queue::make_invalid(), tbb::internal::market::max_num_workers(), tbb::internal::input_buffer::note_done(), tbb::internal::task_stream< num_priority_levels >::pop(), tbb::internal::task_stream< num_priority_levels >::pop_specific(), tbb::internal::micro_queue::push(), tbb::internal::task_stream< num_priority_levels >::push(), tbb::strict_ppl::internal::micro_queue< T >::push(), tbb::internal::input_buffer::put_token(), tbb::flow::interface10::graph::register_node(), tbb::flow::interface11::limiter_node< T, U >::register_predecessor(), tbb::flow::interface11::input_node< Output >::register_successor(), tbb::flow::interface11::source_node< Output >::register_successor(), tbb::flow::interface11::limiter_node< T, U >::register_successor(), tbb::internal::market::release(), tbb::flow::interface10::graph::remove_node(), tbb::internal::input_buffer::return_item(), tbb::flow::interface11::opencl_memory< Factory >::send(), tbb::internal::market::set_active_num_workers(), tbb::flow::interface11::internal::join_node_FE< queueing, InputTuple, OutputTuple >::set_my_node(), tbb::flow::interface11::source_node< Output >::try_consume(), tbb::flow::interface11::input_node< Output >::try_get(), tbb::flow::interface11::source_node< Output >::try_get(), tbb::internal::rml::private_server::try_insert_in_asleep_list(), tbb::internal::task_stream< num_priority_levels >::try_pop(), tbb::internal::task_stream< num_priority_levels >::try_push(), tbb::flow::interface11::limiter_node< T, U >::try_put_task(), tbb::flow::interface11::input_node< Output >::try_release(), tbb::flow::interface11::source_node< Output >::try_release(), tbb::flow::interface11::input_node< Output >::try_reserve(), tbb::flow::interface11::source_node< Output >::try_reserve(), tbb::flow::interface11::input_node< Output >::try_reserve_apply_body(), tbb::flow::interface11::source_node< Output >::try_reserve_apply_body(), tbb::internal::rml::private_server::wake_some(), tbb::internal::micro_queue_pop_finalizer::~micro_queue_pop_finalizer(), and tbb::strict_ppl::internal::micro_queue_pop_finalizer< T >::~micro_queue_pop_finalizer().
| void __TBB_EXPORTED_METHOD tbb::interface5::lock_read | ( | ) |
Acquires the reader_writer_lock for read.
If the lock is currently held by a writer, this reader will block and wait until the writers are done. Exceptions thrown: improper_lock The context tries to acquire a reader_writer_lock that it already has write ownership of.
| tbb::interface5::reader_writer_lock | ( | ) |
Constructs a new reader_writer_lock.
Definition at line 88 of file reader_writer_lock.h.
References internal_construct().
|
private |
Sets writer_head to w and attempts to unblock.
Definition at line 157 of file reader_writer_lock.cpp.
References __TBB_AtomicOR(), active, fetch_and_or(), RC_INCR, rdr_count_and_flags, RFLAG, spin_wait_until_and(), spin_wait_while_geq(), tbb::interface5::scoped_lock::status, waiting_nonblocking, WFLAG1, WFLAG2, and writer_head.
Referenced by end_write(), and start_write().
| void tbb::interface5::spin_wait_until_and | ( | const volatile T & | location, |
| U | value | ||
| ) |
Spin UNTIL (location & value) is true.
T and U should be comparable types.
Definition at line 65 of file reader_writer_lock.cpp.
References tbb::internal::atomic_backoff::pause().
Referenced by set_next_writer().
| void tbb::interface5::spin_wait_while_geq | ( | const volatile T & | location, |
| U | value | ||
| ) |
Spin WHILE the value at the location is greater than or equal to a given value.
T and U should be comparable types.
Definition at line 57 of file reader_writer_lock.cpp.
References tbb::internal::atomic_backoff::pause().
Referenced by set_next_writer().
|
private |
Attempts to acquire read lock.
If unavailable, spins in blocking case, returns false in non-blocking case.
Definition at line 209 of file reader_writer_lock.cpp.
References __TBB_ASSERT, active, fetch_and_or(), ITT_NOTIFY, tbb::interface5::scoped_lock_read::next, RC_INCR, rdr_count_and_flags, reader_head, RFLAG, tbb::internal::spin_wait_while_eq(), tbb::interface5::scoped_lock_read::status, unblock_readers(), waiting, WFLAG1, and WFLAG2.
|
private |
Attempts to acquire write lock.
If unavailable, spins in blocking case, returns false in non-blocking case.
Definition at line 118 of file reader_writer_lock.cpp.
References __TBB_ASSERT, tbb::this_tbb_thread::get_id(), id, ITT_NOTIFY, my_current_writer, tbb::interface5::scoped_lock::next, set_next_writer(), tbb::internal::spin_wait_while_eq(), tbb::interface5::scoped_lock::status, waiting, waiting_nonblocking, writer_head, and writer_tail.
| bool __TBB_EXPORTED_METHOD tbb::interface5::try_lock | ( | ) |
Tries to acquire the reader_writer_lock for write.
This function does not block. Return Value: True or false, depending on whether the lock is acquired or not. If the lock is already held by this acquiring context, try_lock() returns false.
Tries to acquire the reader_writer_lock for write.
Return true if lock acquired; false otherwise.
Definition at line 174 of file mutex.h.
| bool __TBB_EXPORTED_METHOD tbb::interface5::try_lock_read | ( | ) |
Tries to acquire the reader_writer_lock for read.
This function does not block. Return Value: True or false, depending on whether the lock is acquired or not.
|
private |
Unblocks pending readers.
Definition at line 228 of file reader_writer_lock.cpp.
References __TBB_ASSERT, __TBB_AtomicOR(), active, head, RC_INCR, rdr_count_and_flags, reader_head, RFLAG, tbb::interface5::scoped_lock_read::status, waiting, WFLAG1, and WFLAG2.
Referenced by end_write(), and start_read().
| void __TBB_EXPORTED_METHOD tbb::interface5::unlock | ( | ) |
Releases the reader_writer_lock.
Releases the reader_writer_lock.
Definition at line 190 of file mutex.h.
Referenced by tbb::internal::generic_scheduler::steal_task_from().
| tbb::interface5::~reader_writer_lock | ( | ) |
Destructs a reader_writer_lock object.
Definition at line 93 of file reader_writer_lock.h.
References internal_destroy().
| tbb_thread::id tbb::interface5::my_current_writer |
Writer that owns the mutex; tbb_thread::id() otherwise.
Definition at line 232 of file reader_writer_lock.h.
Referenced by end_write(), is_current_writer(), and start_write().
| const uintptr_t tbb::interface5::RC_INCR = 0x8 |
Definition at line 33 of file reader_writer_lock.cpp.
Referenced by end_read(), set_next_writer(), start_read(), and unblock_readers().
| atomic<uintptr_t> tbb::interface5::rdr_count_and_flags |
Status of mutex.
Definition at line 234 of file reader_writer_lock.h.
Referenced by end_read(), end_write(), set_next_writer(), start_read(), and unblock_readers().
| atomic<scoped_lock_read*> tbb::interface5::reader_head |
The list of pending readers.
Definition at line 226 of file reader_writer_lock.h.
Referenced by start_read(), and unblock_readers().
| const uintptr_t tbb::interface5::RFLAG = 0x4 |
Definition at line 32 of file reader_writer_lock.cpp.
Referenced by end_write(), set_next_writer(), start_read(), and unblock_readers().
| const uintptr_t tbb::interface5::WFLAG1 = 0x1 |
Definition at line 30 of file reader_writer_lock.cpp.
Referenced by end_write(), set_next_writer(), start_read(), and unblock_readers().
| const uintptr_t tbb::interface5::WFLAG2 = 0x2 |
Definition at line 31 of file reader_writer_lock.cpp.
Referenced by end_write(), set_next_writer(), start_read(), and unblock_readers().
| atomic<scoped_lock*> tbb::interface5::writer_head |
The list of pending writers.
Definition at line 228 of file reader_writer_lock.h.
Referenced by end_write(), set_next_writer(), and start_write().
| atomic<scoped_lock*> tbb::interface5::writer_tail |
The last node in the list of pending writers.
Definition at line 230 of file reader_writer_lock.h.
Referenced by end_write(), and start_write().