21 #ifndef __TBB_task_scheduler_observer_H 22 #define __TBB_task_scheduler_observer_H 25 #if __TBB_ARENA_OBSERVER || __TBB_SLEEP_PERMISSION 29 #if __TBB_SCHEDULER_OBSERVER 32 namespace interface6 {
91 #if __TBB_ARENA_OBSERVER || __TBB_SLEEP_PERMISSION 92 namespace interface6 {
94 friend class internal::task_scheduler_observer_v3;
95 friend class internal::observer_proxy;
96 friend class internal::observer_list;
101 static const intptr_t v6_trait = (intptr_t)((~(uintptr_t)0 >> 1) + 1);
104 intptr_t my_context_tag;
105 enum { global_tag = 0, implicit_tag = 1 };
119 #if __TBB_ARENA_OBSERVER 120 my_context_tag = local? implicit_tag : global_tag;
123 my_context_tag = global_tag;
127 #if __TBB_ARENA_OBSERVER 133 my_context_tag = (intptr_t)&a;
145 void observe(
bool state=
true ) {
153 #if __TBB_SLEEP_PERMISSION 154 enum { keep_awake =
false, allow_sleep =
true };
160 virtual bool may_sleep() {
return allow_sleep; }
observer_proxy * my_proxy
Pointer to the proxy holding this observer.
tbb::internal::task_scheduler_observer_v3 task_scheduler_observer
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
void __TBB_EXPORTED_METHOD observe(bool state=true)
Enable or disable observation.
#define __TBB_ASSERT_EX(predicate, comment)
"Extended" version is useful to suppress warnings if a variable is only used with an assert ...
virtual void on_scheduler_entry(bool)
Entry notification.
#define __TBB_EXPORTED_METHOD
friend class observer_proxy
atomic< intptr_t > my_busy_count
Counter preventing the observer from being destroyed while in use by the scheduler.
void store(value_type value)
friend class observer_list
virtual ~task_scheduler_observer_v3()
Destructor automatically switches observation off if it is enabled.
bool is_observing() const
Returns true if observation is enabled, false otherwise.
virtual void on_scheduler_exit(bool)
Exit notification.
task_scheduler_observer_v3()
Construct observer with observation disabled.