Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
task_group_context.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2005-2018 Intel Corporation
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16 
17 
18 
19 */
20 
21 #include "scheduler.h"
22 
23 #include "itt_notify.h"
24 
25 namespace tbb {
26 
27 #if __TBB_TASK_GROUP_CONTEXT
28 
29 using namespace internal;
30 
31 //------------------------------------------------------------------------
32 // captured_exception
33 //------------------------------------------------------------------------
34 
35 inline char* duplicate_string ( const char* src ) {
36  char* dst = NULL;
37  if ( src ) {
38  size_t len = strlen(src) + 1;
39  dst = (char*)allocate_via_handler_v3(len);
40  strncpy (dst, src, len);
41  }
42  return dst;
43 }
44 
46  clear();
47 }
48 
49 void captured_exception::set ( const char* a_name, const char* info ) throw() {
50  my_exception_name = duplicate_string( a_name );
51  my_exception_info = duplicate_string( info );
52 }
53 
54 void captured_exception::clear () throw() {
55  deallocate_via_handler_v3 (const_cast<char*>(my_exception_name));
56  deallocate_via_handler_v3 (const_cast<char*>(my_exception_info));
57 }
58 
59 captured_exception* captured_exception::move () throw() {
60  captured_exception *e = (captured_exception*)allocate_via_handler_v3(sizeof(captured_exception));
61  if ( e ) {
62  ::new (e) captured_exception();
63  e->my_exception_name = my_exception_name;
64  e->my_exception_info = my_exception_info;
65  e->my_dynamic = true;
66  my_exception_name = my_exception_info = NULL;
67  }
68  return e;
69 }
70 
71 void captured_exception::destroy () throw() {
72  __TBB_ASSERT ( my_dynamic, "Method destroy can be used only on objects created by clone or allocate" );
73  if ( my_dynamic ) {
76  }
77 }
78 
79 captured_exception* captured_exception::allocate ( const char* a_name, const char* info ) {
80  captured_exception *e = (captured_exception*)allocate_via_handler_v3( sizeof(captured_exception) );
81  if ( e ) {
82  ::new (e) captured_exception(a_name, info);
83  e->my_dynamic = true;
84  }
85  return e;
86 }
87 
88 const char* captured_exception::name() const throw() {
89  return my_exception_name;
90 }
91 
92 const char* captured_exception::what() const throw() {
93  return my_exception_info;
94 }
95 
96 
97 //------------------------------------------------------------------------
98 // tbb_exception_ptr
99 //------------------------------------------------------------------------
100 
101 #if !TBB_USE_CAPTURED_EXCEPTION
102 
103 namespace internal {
104 
105 template<typename T>
106 tbb_exception_ptr* AllocateExceptionContainer( const T& src ) {
107  tbb_exception_ptr *eptr = (tbb_exception_ptr*)allocate_via_handler_v3( sizeof(tbb_exception_ptr) );
108  if ( eptr )
109  new (eptr) tbb_exception_ptr(src);
110  return eptr;
111 }
112 
113 tbb_exception_ptr* tbb_exception_ptr::allocate () {
114  return AllocateExceptionContainer( std::current_exception() );
115 }
116 
117 tbb_exception_ptr* tbb_exception_ptr::allocate ( const tbb_exception& ) {
118  return AllocateExceptionContainer( std::current_exception() );
119 }
120 
121 tbb_exception_ptr* tbb_exception_ptr::allocate ( captured_exception& src ) {
122  tbb_exception_ptr *res = AllocateExceptionContainer( src );
123  src.destroy();
124  return res;
125 }
126 
127 void tbb_exception_ptr::destroy () throw() {
128  this->tbb_exception_ptr::~tbb_exception_ptr();
130 }
131 
132 } // namespace internal
133 #endif /* !TBB_USE_CAPTURED_EXCEPTION */
134 
135 
136 //------------------------------------------------------------------------
137 // task_group_context
138 //------------------------------------------------------------------------
139 
141  if ( __TBB_load_relaxed(my_kind) == binding_completed ) {
142  if ( governor::is_set(my_owner) ) {
143  // Local update of the context list
144  uintptr_t local_count_snapshot = my_owner->my_context_state_propagation_epoch;
145  my_owner->my_local_ctx_list_update.store<relaxed>(1);
146  // Prevent load of nonlocal update flag from being hoisted before the
147  // store to local update flag.
148  atomic_fence();
149  if ( my_owner->my_nonlocal_ctx_list_update.load<relaxed>() ) {
150  spin_mutex::scoped_lock lock(my_owner->my_context_list_mutex);
151  my_node.my_prev->my_next = my_node.my_next;
152  my_node.my_next->my_prev = my_node.my_prev;
153  my_owner->my_local_ctx_list_update.store<relaxed>(0);
154  }
155  else {
156  my_node.my_prev->my_next = my_node.my_next;
157  my_node.my_next->my_prev = my_node.my_prev;
158  // Release fence is necessary so that update of our neighbors in
159  // the context list was committed when possible concurrent destroyer
160  // proceeds after local update flag is reset by the following store.
161  my_owner->my_local_ctx_list_update.store<release>(0);
162  if ( local_count_snapshot != the_context_state_propagation_epoch ) {
163  // Another thread was propagating cancellation request when we removed
164  // ourselves from the list. We must ensure that it is not accessing us
165  // when this destructor finishes. We'll be able to acquire the lock
166  // below only after the other thread finishes with us.
167  spin_mutex::scoped_lock lock(my_owner->my_context_list_mutex);
168  }
169  }
170  }
171  else {
172  // Nonlocal update of the context list
173  // Synchronizes with generic_scheduler::cleanup_local_context_list()
174  // TODO: evaluate and perhaps relax, or add some lock instead
175  if ( internal::as_atomic(my_kind).fetch_and_store(dying) == detached ) {
176  my_node.my_prev->my_next = my_node.my_next;
177  my_node.my_next->my_prev = my_node.my_prev;
178  }
179  else {
180  //TODO: evaluate and perhaps relax
181  my_owner->my_nonlocal_ctx_list_update.fetch_and_increment<full_fence>();
182  //TODO: evaluate and perhaps remove
183  spin_wait_until_eq( my_owner->my_local_ctx_list_update, 0u );
184  my_owner->my_context_list_mutex.lock();
185  my_node.my_prev->my_next = my_node.my_next;
186  my_node.my_next->my_prev = my_node.my_prev;
187  my_owner->my_context_list_mutex.unlock();
188  //TODO: evaluate and perhaps relax
189  my_owner->my_nonlocal_ctx_list_update.fetch_and_decrement<full_fence>();
190  }
191  }
192  }
193 #if __TBB_FP_CONTEXT
194  internal::punned_cast<cpu_ctl_env*>(&my_cpu_ctl_env)->~cpu_ctl_env();
195 #endif
196  poison_value(my_version_and_traits);
197  if ( my_exception )
198  my_exception->destroy();
199  ITT_STACK(itt_caller != ITT_CALLER_NULL, caller_destroy, itt_caller);
200 }
201 
202 void task_group_context::init () {
203  internal::string_index name = internal::CUSTOM_CTX;
204  // Check version of task group context to avoid reporting misleading identifier.
205  if( ( my_version_and_traits & version_mask ) >= 3 ) {
206  __TBB_ASSERT ( my_name >= 0 && my_name < NUM_STRINGS, "Context description out of valid range" );
207  name = my_name;
208  }
209  ITT_TASK_GROUP(this, name, NULL);
210  suppress_unused_warning(name); // in case if ITT_TASK_GROUP is no-op.
211  __TBB_STATIC_ASSERT ( sizeof(my_version_and_traits) >= 4, "Layout of my_version_and_traits must be reconsidered on this platform" );
212  __TBB_STATIC_ASSERT ( sizeof(task_group_context) == 2 * NFS_MaxLineSize, "Context class has wrong size - check padding and members alignment" );
213  __TBB_ASSERT ( (uintptr_t(this) & (sizeof(my_cancellation_requested) - 1)) == 0, "Context is improperly aligned" );
214  __TBB_ASSERT ( __TBB_load_relaxed(my_kind) == isolated || __TBB_load_relaxed(my_kind) == bound, "Context can be created only as isolated or bound" );
215  my_parent = NULL;
216  my_cancellation_requested = 0;
217  my_exception = NULL;
218  my_owner = NULL;
219  my_state = 0;
220  itt_caller = ITT_CALLER_NULL;
221 #if __TBB_TASK_PRIORITY
222  my_priority = normalized_normal_priority;
223 #endif /* __TBB_TASK_PRIORITY */
224 #if __TBB_FP_CONTEXT
225  __TBB_STATIC_ASSERT( sizeof(my_cpu_ctl_env) == sizeof(internal::uint64_t), "The reserved space for FPU settings are not equal sizeof(uint64_t)" );
226  __TBB_STATIC_ASSERT( sizeof(cpu_ctl_env) <= sizeof(my_cpu_ctl_env), "FPU settings storage does not fit to uint64_t" );
227  suppress_unused_warning( my_cpu_ctl_env.space );
228 
229  cpu_ctl_env &ctl = *internal::punned_cast<cpu_ctl_env*>(&my_cpu_ctl_env);
230  new ( &ctl ) cpu_ctl_env;
231  if ( my_version_and_traits & fp_settings )
232  ctl.get_env();
233 #endif
234 }
235 
236 void task_group_context::register_with ( generic_scheduler *local_sched ) {
237  __TBB_ASSERT( local_sched, NULL );
238  my_owner = local_sched;
239  // state propagation logic assumes new contexts are bound to head of the list
240  my_node.my_prev = &local_sched->my_context_list_head;
241  // Notify threads that may be concurrently destroying contexts registered
242  // in this scheduler's list that local list update is underway.
243  local_sched->my_local_ctx_list_update.store<relaxed>(1);
244  // Prevent load of global propagation epoch counter from being hoisted before
245  // speculative stores above, as well as load of nonlocal update flag from
246  // being hoisted before the store to local update flag.
247  atomic_fence();
248  // Finalize local context list update
249  if ( local_sched->my_nonlocal_ctx_list_update.load<relaxed>() ) {
250  spin_mutex::scoped_lock lock(my_owner->my_context_list_mutex);
251  local_sched->my_context_list_head.my_next->my_prev = &my_node;
252  my_node.my_next = local_sched->my_context_list_head.my_next;
253  my_owner->my_local_ctx_list_update.store<relaxed>(0);
254  local_sched->my_context_list_head.my_next = &my_node;
255  }
256  else {
257  local_sched->my_context_list_head.my_next->my_prev = &my_node;
258  my_node.my_next = local_sched->my_context_list_head.my_next;
259  my_owner->my_local_ctx_list_update.store<release>(0);
260  // Thread-local list of contexts allows concurrent traversal by another thread
261  // while propagating state change. To ensure visibility of my_node's members
262  // to the concurrently traversing thread, the list's head is updated by means
263  // of store-with-release.
264  __TBB_store_with_release(local_sched->my_context_list_head.my_next, &my_node);
265  }
266 }
267 
268 void task_group_context::bind_to ( generic_scheduler *local_sched ) {
269  __TBB_ASSERT ( __TBB_load_relaxed(my_kind) == binding_required, "Already bound or isolated?" );
270  __TBB_ASSERT ( !my_parent, "Parent is set before initial binding" );
271  my_parent = local_sched->my_innermost_running_task->prefix().context;
272 #if __TBB_FP_CONTEXT
273  // Inherit FPU settings only if the context has not captured FPU settings yet.
274  if ( !(my_version_and_traits & fp_settings) )
275  copy_fp_settings(*my_parent);
276 #endif
277 
278  // Condition below prevents unnecessary thrashing parent context's cache line
279  if ( !(my_parent->my_state & may_have_children) )
280  my_parent->my_state |= may_have_children; // full fence is below
281  if ( my_parent->my_parent ) {
282  // Even if this context were made accessible for state change propagation
283  // (by placing __TBB_store_with_release(s->my_context_list_head.my_next, &my_node)
284  // above), it still could be missed if state propagation from a grand-ancestor
285  // was underway concurrently with binding.
286  // Speculative propagation from the parent together with epoch counters
287  // detecting possibility of such a race allow to avoid taking locks when
288  // there is no contention.
289 
290  // Acquire fence is necessary to prevent reordering subsequent speculative
291  // loads of parent state data out of the scope where epoch counters comparison
292  // can reliably validate it.
293  uintptr_t local_count_snapshot = __TBB_load_with_acquire( my_parent->my_owner->my_context_state_propagation_epoch );
294  // Speculative propagation of parent's state. The speculation will be
295  // validated by the epoch counters check further on.
296  my_cancellation_requested = my_parent->my_cancellation_requested;
297 #if __TBB_TASK_PRIORITY
298  my_priority = my_parent->my_priority;
299 #endif /* __TBB_TASK_PRIORITY */
300  register_with( local_sched ); // Issues full fence
301 
302  // If no state propagation was detected by the following condition, the above
303  // full fence guarantees that the parent had correct state during speculative
304  // propagation before the fence. Otherwise the propagation from parent is
305  // repeated under the lock.
306  if ( local_count_snapshot != the_context_state_propagation_epoch ) {
307  // Another thread may be propagating state change right now. So resort to lock.
308  context_state_propagation_mutex_type::scoped_lock lock(the_context_state_propagation_mutex);
309  my_cancellation_requested = my_parent->my_cancellation_requested;
310 #if __TBB_TASK_PRIORITY
311  my_priority = my_parent->my_priority;
312 #endif /* __TBB_TASK_PRIORITY */
313  }
314  }
315  else {
316  register_with( local_sched ); // Issues full fence
317  // As we do not have grand-ancestors, concurrent state propagation (if any)
318  // may originate only from the parent context, and thus it is safe to directly
319  // copy the state from it.
320  my_cancellation_requested = my_parent->my_cancellation_requested;
321 #if __TBB_TASK_PRIORITY
322  my_priority = my_parent->my_priority;
323 #endif /* __TBB_TASK_PRIORITY */
324  }
325  __TBB_store_relaxed(my_kind, binding_completed);
326 }
327 
328 template <typename T>
329 void task_group_context::propagate_task_group_state ( T task_group_context::*mptr_state, task_group_context& src, T new_state ) {
330  if (this->*mptr_state == new_state) {
331  // Nothing to do, whether descending from "src" or not, so no need to scan.
332  // Hopefully this happens often thanks to earlier invocations.
333  // This optimization is enabled by LIFO order in the context lists:
334  // - new contexts are bound to the beginning of lists;
335  // - descendants are newer than ancestors;
336  // - earlier invocations are therefore likely to "paint" long chains.
337  }
338  else if (this == &src) {
339  // This clause is disjunct from the traversal below, which skips src entirely.
340  // Note that src.*mptr_state is not necessarily still equal to new_state (another thread may have changed it again).
341  // Such interference is probably not frequent enough to aim for optimisation by writing new_state again (to make the other thread back down).
342  // Letting the other thread prevail may also be fairer.
343  }
344  else {
345  for ( task_group_context *ancestor = my_parent; ancestor != NULL; ancestor = ancestor->my_parent ) {
346  __TBB_ASSERT(internal::is_alive(ancestor->my_version_and_traits), "context tree was corrupted");
347  if ( ancestor == &src ) {
348  for ( task_group_context *ctx = this; ctx != ancestor; ctx = ctx->my_parent )
349  ctx->*mptr_state = new_state;
350  break;
351  }
352  }
353  }
354 }
355 
356 template <typename T>
357 void generic_scheduler::propagate_task_group_state ( T task_group_context::*mptr_state, task_group_context& src, T new_state ) {
358  spin_mutex::scoped_lock lock(my_context_list_mutex);
359  // Acquire fence is necessary to ensure that the subsequent node->my_next load
360  // returned the correct value in case it was just inserted in another thread.
361  // The fence also ensures visibility of the correct my_parent value.
362  context_list_node_t *node = __TBB_load_with_acquire(my_context_list_head.my_next);
363  while ( node != &my_context_list_head ) {
364  task_group_context &ctx = __TBB_get_object_ref(task_group_context, my_node, node);
365  if ( ctx.*mptr_state != new_state )
366  ctx.propagate_task_group_state( mptr_state, src, new_state );
367  node = node->my_next;
368  __TBB_ASSERT( is_alive(ctx.my_version_and_traits), "Local context list contains destroyed object" );
369  }
370  // Sync up local propagation epoch with the global one. Release fence prevents
371  // reordering of possible store to *mptr_state after the sync point.
372  __TBB_store_with_release(my_context_state_propagation_epoch, the_context_state_propagation_epoch);
373 }
374 
375 template <typename T>
376 bool market::propagate_task_group_state ( T task_group_context::*mptr_state, task_group_context& src, T new_state ) {
377  if ( !(src.my_state & task_group_context::may_have_children) )
378  return true;
379  // The whole propagation algorithm is under the lock in order to ensure correctness
380  // in case of concurrent state changes at the different levels of the context tree.
381  // See comment at the bottom of scheduler.cpp
382  context_state_propagation_mutex_type::scoped_lock lock(the_context_state_propagation_mutex);
383  if ( src.*mptr_state != new_state )
384  // Another thread has concurrently changed the state. Back down.
385  return false;
386  // Advance global state propagation epoch
387  __TBB_FetchAndAddWrelease(&the_context_state_propagation_epoch, 1);
388  // Propagate to all workers and masters and sync up their local epochs with the global one
389  unsigned num_workers = my_first_unused_worker_idx;
390  for ( unsigned i = 0; i < num_workers; ++i ) {
391  generic_scheduler *s = my_workers[i];
392  // If the worker is only about to be registered, skip it.
393  if ( s )
394  s->propagate_task_group_state( mptr_state, src, new_state );
395  }
396  // Propagate to all master threads
397  // The whole propagation sequence is locked, thus no contention is expected
398  for( scheduler_list_type::iterator it = my_masters.begin(); it != my_masters.end(); it++ )
399  it->propagate_task_group_state( mptr_state, src, new_state );
400  return true;
401 }
402 
404  __TBB_ASSERT ( my_cancellation_requested == 0 || my_cancellation_requested == 1, "Invalid cancellation state");
405  if ( my_cancellation_requested || as_atomic(my_cancellation_requested).compare_and_swap(1, 0) ) {
406  // This task group and any descendants have already been canceled.
407  // (A newly added descendant would inherit its parent's my_cancellation_requested,
408  // not missing out on any cancellation still being propagated, and a context cannot be uncanceled.)
409  return false;
410  }
411  governor::local_scheduler_weak()->my_market->propagate_task_group_state( &task_group_context::my_cancellation_requested, *this, (uintptr_t)1 );
412  return true;
413 }
414 
416  return my_cancellation_requested != 0;
417 }
418 
419 // IMPORTANT: It is assumed that this method is not used concurrently!
422  // No fences are necessary since this context can be accessed from another thread
423  // only after stealing happened (which means necessary fences were used).
424  if ( my_exception ) {
425  my_exception->destroy();
426  my_exception = NULL;
427  }
428  my_cancellation_requested = 0;
429 }
430 
431 #if __TBB_FP_CONTEXT
432 // IMPORTANT: It is assumed that this method is not used concurrently!
435  // No fences are necessary since this context can be accessed from another thread
436  // only after stealing happened (which means necessary fences were used).
437  cpu_ctl_env &ctl = *internal::punned_cast<cpu_ctl_env*>(&my_cpu_ctl_env);
438  if ( !(my_version_and_traits & fp_settings) ) {
439  new ( &ctl ) cpu_ctl_env;
440  my_version_and_traits |= fp_settings;
441  }
442  ctl.get_env();
443 }
444 
445 void task_group_context::copy_fp_settings( const task_group_context &src ) {
446  __TBB_ASSERT( !(my_version_and_traits & fp_settings), "The context already has FPU settings." );
447  __TBB_ASSERT( src.my_version_and_traits & fp_settings, "The source context does not have FPU settings." );
448 
449  cpu_ctl_env &ctl = *internal::punned_cast<cpu_ctl_env*>(&my_cpu_ctl_env);
450  cpu_ctl_env &src_ctl = *internal::punned_cast<cpu_ctl_env*>(&src.my_cpu_ctl_env);
451  new (&ctl) cpu_ctl_env( src_ctl );
452  my_version_and_traits |= fp_settings;
453 }
454 #endif /* __TBB_FP_CONTEXT */
455 
457  if ( my_cancellation_requested )
458  return;
459 #if TBB_USE_EXCEPTIONS
460  try {
461  throw;
462  } TbbCatchAll( this );
463 #endif /* TBB_USE_EXCEPTIONS */
464 }
465 
466 #if __TBB_TASK_PRIORITY
468  __TBB_ASSERT( prio == priority_low || prio == priority_normal || prio == priority_high, "Invalid priority level value" );
469  intptr_t p = normalize_priority(prio);
470  if ( my_priority == p && !(my_state & task_group_context::may_have_children))
471  return;
472  my_priority = p;
473  internal::generic_scheduler* s = governor::local_scheduler_if_initialized();
474  if ( !s || !s->my_arena || !s->my_market->propagate_task_group_state(&task_group_context::my_priority, *this, p) )
475  return;
476 
478  // need to find out the right arena for priority update.
479  // The executing status check only guarantees being inside some working arena.
480  if ( s->my_innermost_running_task->state() == task::executing )
481  // Updating arena priority here does not eliminate necessity of checking each
482  // task priority and updating arena priority if necessary before the task execution.
483  // These checks will be necessary because:
484  // a) set_priority() may be invoked before any tasks from this task group are spawned;
485  // b) all spawned tasks from this task group are retrieved from the task pools.
486  // These cases create a time window when arena priority may be lowered.
487  s->my_market->update_arena_priority( *s->my_arena, p );
488 }
489 
491  return static_cast<priority_t>(priority_from_normalized_rep[my_priority]);
492 }
493 #endif /* __TBB_TASK_PRIORITY */
494 
495 #endif /* __TBB_TASK_GROUP_CONTEXT */
496 
497 } // namespace tbb
void *__TBB_EXPORTED_FUNC allocate_via_handler_v3(size_t n)
Allocates memory using MallocHandler.
bool __TBB_EXPORTED_METHOD cancel_group_execution()
Initiates cancellation of all tasks in this cancellation group and its subordinate groups.
void spin_wait_until_eq(const volatile T &location, const U value)
Spin UNTIL the value of the variable is equal to a given value.
Definition: tbb_machine.h:403
void copy_fp_settings(const task_group_context &src)
Copies FPU control setting from another context.
void __TBB_EXPORTED_METHOD destroy() __TBB_override
Destroys objects created by the move() method.
const size_t NFS_MaxLineSize
Compile-time constant that is upper bound on cache line/sector size.
Definition: tbb_stddef.h:220
void __TBB_store_with_release(volatile T &location, V value)
Definition: tbb_machine.h:717
const char *__TBB_EXPORTED_METHOD name() const __TBB_override
Returns RTTI name of the originally intercepted exception.
atomic< T > & as_atomic(T &t)
Definition: atomic.h:547
friend class scoped_lock
Definition: spin_mutex.h:180
void const char const char int ITT_FORMAT __itt_group_sync s
#define __TBB_get_object_ref(class_name, member_name, member_addr)
Returns address of the object containing a member with the given name and address.
Definition: tbb_stddef.h:274
#define ITT_CALLER_NULL
Definition: itt_notify.h:52
void __TBB_EXPORTED_METHOD init()
Out-of-line part of the constructor.
atomic< unsigned > my_first_unused_worker_idx
First unused index of worker.
Definition: market.h:90
void propagate_task_group_state(T task_group_context::*mptr_state, task_group_context &src, T new_state)
Propagates any state change detected to *this, and as an optimisation possibly also upward along the ...
captured_exception *__TBB_EXPORTED_METHOD move() __TBB_override
Creates and returns pointer to the deep copy of this exception object.
task is running, and will be destroyed after method execute() completes.
Definition: task.h:598
void __TBB_EXPORTED_METHOD reset()
Forcefully reinitializes the context after the task tree it was associated with is completed.
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
Release.
Definition: atomic.h:49
void const char const char int ITT_FORMAT __itt_group_sync p
void set_priority(priority_t)
Changes priority of the task group.
T __TBB_load_with_acquire(const volatile T &location)
Definition: tbb_machine.h:713
static generic_scheduler * local_scheduler_if_initialized()
Definition: governor.h:136
__TBB_EXPORTED_METHOD ~task_group_context()
priority_t priority() const
Retrieves current priority of the current task group.
static bool is_set(generic_scheduler *s)
Used to check validity of the local scheduler TLS contents.
Definition: governor.cpp:124
static generic_scheduler * local_scheduler_weak()
Definition: governor.h:131
No ordering.
Definition: atomic.h:51
void __TBB_EXPORTED_FUNC deallocate_via_handler_v3(void *p)
Deallocates memory using FreeHandler.
#define ITT_TASK_GROUP(type, name, parent)
Definition: itt_notify.h:125
friend class generic_scheduler
Definition: market.h:50
intptr_t my_priority
Priority level of the task group (in normalized representation)
Definition: task.h:420
void destroy()
Destroys this objects.
void __TBB_EXPORTED_METHOD clear()
#define ITT_STACK(precond, name, obj)
Definition: itt_notify.h:123
void __TBB_EXPORTED_METHOD register_pending_exception()
Records the pending exception, and cancels the task group.
void __TBB_store_relaxed(volatile T &location, V value)
Definition: tbb_machine.h:743
The graph class.
static tbb_exception_ptr * allocate()
market * my_market
The market I am in.
Definition: scheduler.h:146
static captured_exception * allocate(const char *name, const char *info)
Functionally equivalent to {captured_exception e(name,info); return e.move();}.
void register_with(internal::generic_scheduler *local_sched)
Registers this context with the local scheduler.
void __TBB_EXPORTED_METHOD set(const char *name, const char *info)
void atomic_fence()
Sequentially consistent full memory fence.
Definition: tbb_machine.h:343
Sequential consistency.
Definition: atomic.h:45
void suppress_unused_warning(const T1 &)
Utility template function to prevent "unused" warnings by various compilers.
Definition: tbb_stddef.h:381
__TBB_EXPORTED_METHOD ~captured_exception()
T __TBB_load_relaxed(const volatile T &location)
Definition: tbb_machine.h:739
void bind_to(internal::generic_scheduler *local_sched)
Registers this context with the local scheduler and binds it to its parent context.
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
#define __TBB_FetchAndAddWrelease(P, V)
Definition: tbb_machine.h:313
const char *__TBB_EXPORTED_METHOD what() const __TBB_override
Returns the result of originally intercepted exception's what() method.
void __TBB_EXPORTED_METHOD capture_fp_settings()
Captures the current FPU control settings to the context.
uintptr_t my_cancellation_requested
Specifies whether cancellation was requested for this task group.
Definition: task.h:401
void const char const char int ITT_FORMAT __itt_group_sync x void const char * name
priority_t
Definition: task.h:279
bool __TBB_EXPORTED_METHOD is_group_execution_cancelled() const
Returns true if the context received cancellation request.
#define __TBB_STATIC_ASSERT(condition, msg)
Definition: tbb_stddef.h:545
#define poison_value(g)

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