Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::internal::concurrent_monitor Class Reference

concurrent_monitor More...

#include <concurrent_monitor.h>

Inheritance diagram for tbb::internal::concurrent_monitor:
Collaboration diagram for tbb::internal::concurrent_monitor:

Classes

class  thread_context
 

Public Member Functions

 concurrent_monitor ()
 ctor More...
 
 ~concurrent_monitor ()
 dtor More...
 
void prepare_wait (thread_context &thr, uintptr_t ctx=0)
 prepare wait by inserting 'thr' into the wait queue More...
 
bool commit_wait (thread_context &thr)
 Commit wait if event count has not changed; otherwise, cancel wait. More...
 
void cancel_wait (thread_context &thr)
 Cancel the wait. Removes the thread from the wait queue if not removed yet. More...
 
template<typename WaitUntil , typename Context >
void wait (WaitUntil until, Context on)
 Wait for a condition to be satisfied with waiting-on context. More...
 
void notify_one ()
 Notify one thread about the event. More...
 
void notify_one_relaxed ()
 Notify one thread about the event. Relaxed version. More...
 
void notify_all ()
 Notify all waiting threads of the event. More...
 
void notify_all_relaxed ()
 Notify all waiting threads of the event; Relaxed version. More...
 
template<typename P >
void notify (const P &predicate)
 Notify waiting threads of the event that satisfies the given predicate. More...
 
template<typename P >
void notify_relaxed (const P &predicate)
 Notify waiting threads of the event that satisfies the given predicate; Relaxed version. More...
 
void abort_all ()
 Abort any sleeping threads at the time of the call. More...
 
void abort_all_relaxed ()
 Abort any sleeping threads at the time of the call; Relaxed version. More...
 

Private Member Functions

thread_contextto_thread_context (waitset_node_t *n)
 
- Private Member Functions inherited from tbb::internal::no_copy
 no_copy ()
 Allow default construction. More...
 

Private Attributes

tbb::spin_mutex mutex_ec
 
waitset_t waitset_ec
 
__TBB_atomic unsigned epoch
 

Detailed Description

concurrent_monitor

fine-grained concurrent_monitor implementation

Definition at line 97 of file concurrent_monitor.h.

Constructor & Destructor Documentation

◆ concurrent_monitor()

tbb::internal::concurrent_monitor::concurrent_monitor ( )
inline

ctor

Definition at line 129 of file concurrent_monitor.h.

void __TBB_store_relaxed(volatile T &location, V value)
Definition: tbb_machine.h:743

References tbb::internal::__TBB_store_relaxed(), and epoch.

Here is the call graph for this function:

◆ ~concurrent_monitor()

tbb::internal::concurrent_monitor::~concurrent_monitor ( )

dtor

Definition at line 31 of file concurrent_monitor.cpp.

31  {
32  abort_all();
33  __TBB_ASSERT( waitset_ec.empty(), "waitset not empty?" );
34 }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
void abort_all()
Abort any sleeping threads at the time of the call.

References __TBB_ASSERT, abort_all(), tbb::internal::circular_doubly_linked_list_with_sentinel::empty(), and waitset_ec.

Here is the call graph for this function:

Member Function Documentation

◆ abort_all()

void tbb::internal::concurrent_monitor::abort_all ( )
inline

Abort any sleeping threads at the time of the call.

Definition at line 179 of file concurrent_monitor.h.

void atomic_fence()
Sequentially consistent full memory fence.
Definition: tbb_machine.h:343
void abort_all_relaxed()
Abort any sleeping threads at the time of the call; Relaxed version.

References abort_all_relaxed(), and tbb::atomic_fence().

Referenced by tbb::internal::concurrent_queue_base_v3::internal_abort(), and ~concurrent_monitor().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ abort_all_relaxed()

void tbb::internal::concurrent_monitor::abort_all_relaxed ( )

Abort any sleeping threads at the time of the call; Relaxed version.

Definition at line 111 of file concurrent_monitor.cpp.

111  {
112  if( waitset_ec.empty() )
113  return;
114  waitset_t temp;
115  const waitset_node_t* end;
116  {
119  waitset_ec.flush_to( temp );
120  end = temp.end();
121  for( waitset_node_t* n=temp.front(); n!=end; n=n->next )
122  to_thread_context(n)->in_waitset = false;
123  }
124  waitset_node_t* nxt;
125  for( waitset_node_t* n=temp.front(); n!=end; n=nxt ) {
126  nxt = n->next;
127  to_thread_context(n)->aborted = true;
128  to_thread_context(n)->semaphore().V();
129  }
130 #if TBB_USE_ASSERT
131  temp.clear();
132 #endif
133 }
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 ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp end
circular_doubly_linked_list_with_sentinel::node_t waitset_node_t
thread_context * to_thread_context(waitset_node_t *n)
void __TBB_store_relaxed(volatile T &location, V value)
Definition: tbb_machine.h:743
Represents acquisition of a mutex.
Definition: spin_mutex.h:54
T __TBB_load_relaxed(const volatile T &location)
Definition: tbb_machine.h:739
circular_doubly_linked_list_with_sentinel waitset_t
void flush_to(circular_doubly_linked_list_with_sentinel &lst)
move all elements to 'lst' and initialize the 'this' list

References tbb::internal::__TBB_load_relaxed(), tbb::internal::__TBB_store_relaxed(), tbb::internal::concurrent_monitor::thread_context::aborted, tbb::internal::circular_doubly_linked_list_with_sentinel::clear(), tbb::internal::circular_doubly_linked_list_with_sentinel::empty(), tbb::internal::circular_doubly_linked_list_with_sentinel::end(), end, epoch, tbb::internal::circular_doubly_linked_list_with_sentinel::flush_to(), tbb::internal::circular_doubly_linked_list_with_sentinel::front(), tbb::internal::concurrent_monitor::thread_context::in_waitset, mutex_ec, tbb::internal::circular_doubly_linked_list_with_sentinel::node_t::next, tbb::internal::concurrent_monitor::thread_context::semaphore(), to_thread_context(), tbb::internal::binary_semaphore::V(), and waitset_ec.

Referenced by abort_all().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cancel_wait()

void tbb::internal::concurrent_monitor::cancel_wait ( thread_context thr)

Cancel the wait. Removes the thread from the wait queue if not removed yet.

Definition at line 54 of file concurrent_monitor.cpp.

54  {
55  // possible skipped wakeup will be pumped in the following prepare_wait()
56  thr.skipped_wakeup = true;
57  // try to remove node from waitset
58  bool th_in_waitset = thr.in_waitset;
59  if( th_in_waitset ) {
61  if (thr.in_waitset) {
62  waitset_ec.remove( (waitset_t::node_t&)thr );
63  // node is removed from waitset, so there will be no wakeup
64  thr.in_waitset = false;
65  thr.skipped_wakeup = false;
66  }
67  }
68 }
Represents acquisition of a mutex.
Definition: spin_mutex.h:54

References tbb::internal::concurrent_monitor::thread_context::in_waitset, mutex_ec, tbb::internal::circular_doubly_linked_list_with_sentinel::remove(), tbb::internal::concurrent_monitor::thread_context::skipped_wakeup, and waitset_ec.

Referenced by commit_wait(), tbb::internal::concurrent_queue_base_v3::internal_insert_item(), tbb::internal::concurrent_queue_base_v3::internal_pop(), and wait().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ commit_wait()

bool tbb::internal::concurrent_monitor::commit_wait ( thread_context thr)
inline

Commit wait if event count has not changed; otherwise, cancel wait.

Returns true if committed, false if canceled.

Definition at line 139 of file concurrent_monitor.h.

139  {
140  const bool do_it = thr.epoch == __TBB_load_relaxed(epoch);
141  // this check is just an optimization
142  if( do_it ) {
143  __TBB_ASSERT( thr.ready, "use of commit_wait() without prior prepare_wait()");
144  thr.semaphore().P();
145  __TBB_ASSERT( !thr.in_waitset, "still in the queue?" );
146  if( thr.aborted )
148  } else {
149  cancel_wait( thr );
150  }
151  return do_it;
152  }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
void throw_exception(exception_id eid)
Versionless convenience wrapper for throw_exception_v4()
void cancel_wait(thread_context &thr)
Cancel the wait. Removes the thread from the wait queue if not removed yet.
T __TBB_load_relaxed(const volatile T &location)
Definition: tbb_machine.h:739

References __TBB_ASSERT, tbb::internal::__TBB_load_relaxed(), tbb::internal::concurrent_monitor::thread_context::aborted, cancel_wait(), tbb::internal::eid_user_abort, tbb::internal::concurrent_monitor::thread_context::epoch, epoch, tbb::internal::concurrent_monitor::thread_context::in_waitset, tbb::internal::binary_semaphore::P(), tbb::internal::concurrent_monitor::thread_context::ready, tbb::internal::concurrent_monitor::thread_context::semaphore(), and tbb::internal::throw_exception().

Referenced by tbb::internal::concurrent_queue_base_v3::internal_insert_item(), tbb::internal::concurrent_queue_base_v3::internal_pop(), and wait().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ notify()

template<typename P >
void tbb::internal::concurrent_monitor::notify ( const P &  predicate)
inline

Notify waiting threads of the event that satisfies the given predicate.

Definition at line 173 of file concurrent_monitor.h.

173 {atomic_fence(); notify_relaxed( predicate );}
void atomic_fence()
Sequentially consistent full memory fence.
Definition: tbb_machine.h:343
void notify_relaxed(const P &predicate)
Notify waiting threads of the event that satisfies the given predicate; Relaxed version.

References tbb::atomic_fence(), and notify_relaxed().

Referenced by tbb::internal::concurrent_queue_base_v3::internal_insert_if_not_full(), tbb::internal::concurrent_queue_base_v3::internal_insert_item(), tbb::internal::concurrent_queue_base_v3::internal_pop(), tbb::internal::concurrent_queue_base_v3::internal_pop_if_present(), and tbb::interface7::internal::delegated_task::~delegated_task().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ notify_all()

void tbb::internal::concurrent_monitor::notify_all ( )
inline

Notify all waiting threads of the event.

Definition at line 167 of file concurrent_monitor.h.

void notify_all_relaxed()
Notify all waiting threads of the event; Relaxed version.
void atomic_fence()
Sequentially consistent full memory fence.
Definition: tbb_machine.h:343

References tbb::atomic_fence(), and notify_all_relaxed().

Here is the call graph for this function:

◆ notify_all_relaxed()

void tbb::internal::concurrent_monitor::notify_all_relaxed ( )

Notify all waiting threads of the event; Relaxed version.

Definition at line 88 of file concurrent_monitor.cpp.

88  {
89  if( waitset_ec.empty() )
90  return;
91  waitset_t temp;
92  const waitset_node_t* end;
93  {
96  waitset_ec.flush_to( temp );
97  end = temp.end();
98  for( waitset_node_t* n=temp.front(); n!=end; n=n->next )
99  to_thread_context(n)->in_waitset = false;
100  }
101  waitset_node_t* nxt;
102  for( waitset_node_t* n=temp.front(); n!=end; n=nxt ) {
103  nxt = n->next;
104  to_thread_context(n)->semaphore().V();
105  }
106 #if TBB_USE_ASSERT
107  temp.clear();
108 #endif
109 }
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 ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp end
circular_doubly_linked_list_with_sentinel::node_t waitset_node_t
thread_context * to_thread_context(waitset_node_t *n)
void __TBB_store_relaxed(volatile T &location, V value)
Definition: tbb_machine.h:743
Represents acquisition of a mutex.
Definition: spin_mutex.h:54
T __TBB_load_relaxed(const volatile T &location)
Definition: tbb_machine.h:739
circular_doubly_linked_list_with_sentinel waitset_t
void flush_to(circular_doubly_linked_list_with_sentinel &lst)
move all elements to 'lst' and initialize the 'this' list

References tbb::internal::__TBB_load_relaxed(), tbb::internal::__TBB_store_relaxed(), tbb::internal::circular_doubly_linked_list_with_sentinel::clear(), tbb::internal::circular_doubly_linked_list_with_sentinel::empty(), tbb::internal::circular_doubly_linked_list_with_sentinel::end(), end, epoch, tbb::internal::circular_doubly_linked_list_with_sentinel::flush_to(), tbb::internal::circular_doubly_linked_list_with_sentinel::front(), tbb::internal::concurrent_monitor::thread_context::in_waitset, mutex_ec, tbb::internal::circular_doubly_linked_list_with_sentinel::node_t::next, tbb::internal::concurrent_monitor::thread_context::semaphore(), to_thread_context(), tbb::internal::binary_semaphore::V(), and waitset_ec.

Referenced by notify_all().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ notify_one()

void tbb::internal::concurrent_monitor::notify_one ( )
inline

Notify one thread about the event.

Definition at line 161 of file concurrent_monitor.h.

void atomic_fence()
Sequentially consistent full memory fence.
Definition: tbb_machine.h:343
void notify_one_relaxed()
Notify one thread about the event. Relaxed version.

References tbb::atomic_fence(), and notify_one_relaxed().

Referenced by tbb::internal::generic_scheduler::nested_arena_exit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ notify_one_relaxed()

void tbb::internal::concurrent_monitor::notify_one_relaxed ( )

Notify one thread about the event. Relaxed version.

Definition at line 70 of file concurrent_monitor.cpp.

70  {
71  if( waitset_ec.empty() )
72  return;
73  waitset_node_t* n;
74  const waitset_node_t* end = waitset_ec.end();
75  {
78  n = waitset_ec.front();
79  if( n!=end ) {
80  waitset_ec.remove( *n );
81  to_thread_context(n)->in_waitset = false;
82  }
83  }
84  if( n!=end )
86 }
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 ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp end
circular_doubly_linked_list_with_sentinel::node_t waitset_node_t
thread_context * to_thread_context(waitset_node_t *n)
void __TBB_store_relaxed(volatile T &location, V value)
Definition: tbb_machine.h:743
Represents acquisition of a mutex.
Definition: spin_mutex.h:54
T __TBB_load_relaxed(const volatile T &location)
Definition: tbb_machine.h:739

References tbb::internal::__TBB_load_relaxed(), tbb::internal::__TBB_store_relaxed(), tbb::internal::circular_doubly_linked_list_with_sentinel::empty(), tbb::internal::circular_doubly_linked_list_with_sentinel::end(), end, epoch, tbb::internal::circular_doubly_linked_list_with_sentinel::front(), tbb::internal::concurrent_monitor::thread_context::in_waitset, mutex_ec, tbb::internal::circular_doubly_linked_list_with_sentinel::remove(), tbb::internal::concurrent_monitor::thread_context::semaphore(), to_thread_context(), tbb::internal::binary_semaphore::V(), and waitset_ec.

Referenced by notify_one().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ notify_relaxed()

template<typename P >
void tbb::internal::concurrent_monitor::notify_relaxed ( const P &  predicate)

Notify waiting threads of the event that satisfies the given predicate; Relaxed version.

Definition at line 208 of file concurrent_monitor.h.

208  {
209  if( waitset_ec.empty() )
210  return;
211  waitset_t temp;
212  waitset_node_t* nxt;
213  const waitset_node_t* end = waitset_ec.end();
214  {
217  for( waitset_node_t* n=waitset_ec.last(); n!=end; n=nxt ) {
218  nxt = n->prev;
219  thread_context* thr = to_thread_context( n );
220  if( predicate( thr->context ) ) {
221  waitset_ec.remove( *n );
222  thr->in_waitset = false;
223  temp.add( n );
224  }
225  }
226  }
227 
228  end = temp.end();
229  for( waitset_node_t* n=temp.front(); n!=end; n=nxt ) {
230  nxt = n->next;
231  to_thread_context(n)->semaphore().V();
232  }
233 #if TBB_USE_ASSERT
234  temp.clear();
235 #endif
236 }
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 ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp end
circular_doubly_linked_list_with_sentinel::node_t waitset_node_t
thread_context * to_thread_context(waitset_node_t *n)
void __TBB_store_relaxed(volatile T &location, V value)
Definition: tbb_machine.h:743
Represents acquisition of a mutex.
Definition: spin_mutex.h:54
T __TBB_load_relaxed(const volatile T &location)
Definition: tbb_machine.h:739
circular_doubly_linked_list_with_sentinel waitset_t

References tbb::internal::__TBB_load_relaxed(), tbb::internal::__TBB_store_relaxed(), tbb::internal::circular_doubly_linked_list_with_sentinel::add(), tbb::internal::circular_doubly_linked_list_with_sentinel::clear(), tbb::internal::concurrent_monitor::thread_context::context, tbb::internal::circular_doubly_linked_list_with_sentinel::empty(), tbb::internal::circular_doubly_linked_list_with_sentinel::end(), end, epoch, tbb::internal::circular_doubly_linked_list_with_sentinel::front(), tbb::internal::concurrent_monitor::thread_context::in_waitset, tbb::internal::circular_doubly_linked_list_with_sentinel::last(), mutex_ec, tbb::internal::circular_doubly_linked_list_with_sentinel::node_t::next, tbb::internal::circular_doubly_linked_list_with_sentinel::node_t::prev, tbb::internal::circular_doubly_linked_list_with_sentinel::remove(), tbb::internal::concurrent_monitor::thread_context::semaphore(), to_thread_context(), tbb::internal::binary_semaphore::V(), and waitset_ec.

Referenced by notify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepare_wait()

void tbb::internal::concurrent_monitor::prepare_wait ( thread_context thr,
uintptr_t  ctx = 0 
)

prepare wait by inserting 'thr' into the wait queue

Definition at line 36 of file concurrent_monitor.cpp.

36  {
37  if( !thr.ready )
38  thr.init();
39  // this is good place to pump previous skipped wakeup
40  else if( thr.skipped_wakeup ) {
41  thr.skipped_wakeup = false;
42  thr.semaphore().P();
43  }
44  thr.context = ctx;
45  thr.in_waitset = true;
46  {
49  waitset_ec.add( (waitset_t::node_t*)&thr );
50  }
51  atomic_fence();
52 }
void add(node_t *n)
add to the back of the list
void atomic_fence()
Sequentially consistent full memory fence.
Definition: tbb_machine.h:343
void __TBB_store_relaxed(volatile T &location, V value)
Definition: tbb_machine.h:743
Represents acquisition of a mutex.
Definition: spin_mutex.h:54
T __TBB_load_relaxed(const volatile T &location)
Definition: tbb_machine.h:739

References tbb::internal::__TBB_load_relaxed(), tbb::internal::__TBB_store_relaxed(), tbb::internal::circular_doubly_linked_list_with_sentinel::add(), tbb::atomic_fence(), tbb::internal::concurrent_monitor::thread_context::context, tbb::internal::concurrent_monitor::thread_context::epoch, epoch, tbb::internal::concurrent_monitor::thread_context::in_waitset, mutex_ec, tbb::internal::binary_semaphore::P(), tbb::internal::concurrent_monitor::thread_context::ready, tbb::internal::concurrent_monitor::thread_context::semaphore(), tbb::internal::concurrent_monitor::thread_context::skipped_wakeup, and waitset_ec.

Referenced by tbb::internal::concurrent_queue_base_v3::internal_insert_item(), tbb::internal::concurrent_queue_base_v3::internal_pop(), and wait().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_thread_context()

thread_context* tbb::internal::concurrent_monitor::to_thread_context ( waitset_node_t n)
inlineprivate

Definition at line 188 of file concurrent_monitor.h.

188 { return static_cast<thread_context*>(n); }

Referenced by abort_all_relaxed(), notify_all_relaxed(), notify_one_relaxed(), and notify_relaxed().

Here is the caller graph for this function:

◆ wait()

template<typename WaitUntil , typename Context >
void tbb::internal::concurrent_monitor::wait ( WaitUntil  until,
Context  on 
)

Wait for a condition to be satisfied with waiting-on context.

Definition at line 192 of file concurrent_monitor.h.

193 {
194  bool slept = false;
195  thread_context thr_ctx;
196  prepare_wait( thr_ctx, on() );
197  while( !until() ) {
198  if( (slept = commit_wait( thr_ctx ) )==true )
199  if( until() ) break;
200  slept = false;
201  prepare_wait( thr_ctx, on() );
202  }
203  if( !slept )
204  cancel_wait( thr_ctx );
205 }
void prepare_wait(thread_context &thr, uintptr_t ctx=0)
prepare wait by inserting 'thr' into the wait queue
bool commit_wait(thread_context &thr)
Commit wait if event count has not changed; otherwise, cancel wait.
void cancel_wait(thread_context &thr)
Cancel the wait. Removes the thread from the wait queue if not removed yet.

References cancel_wait(), commit_wait(), and prepare_wait().

Here is the call graph for this function:

Member Data Documentation

◆ epoch

__TBB_atomic unsigned tbb::internal::concurrent_monitor::epoch
private

◆ mutex_ec

tbb::spin_mutex tbb::internal::concurrent_monitor::mutex_ec
private

◆ waitset_ec

waitset_t tbb::internal::concurrent_monitor::waitset_ec
private

The documentation for this class was generated from the following files:

Copyright © 2005-2019 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.