- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Friends | List of all members
tbb::interface6::task_scheduler_observer Class Reference
Inheritance diagram for tbb::interface6::task_scheduler_observer:

## Public Types
enum | { keep_awake = false, allow_sleep = true }
| Return commands for may_sleep()

## Public Member Functions
| task_scheduler_observer (bool local=false)
| Construct local or global observer in inactive state (observation disabled). More...
| task_scheduler_observer (task_arena &a)
| Construct local observer for a given arena in inactive state (observation disabled). More...
virtual | ~task_scheduler_observer ()
void | observe (bool state=true)
| Enable or disable observation. More...
virtual bool | may_sleep ()
| The callback can be invoked by a worker thread before it goes to sleep. More...
Public Member Functions inherited from tbb::internal::task_scheduler_observer_v3
void __TBB_EXPORTED_METHOD | observe (bool state=true)
| Enable or disable observation. More...
bool | is_observing () const
| Returns true if observation is enabled, false otherwise.
| task_scheduler_observer_v3 ()
| Construct observer with observation disabled.
virtual void | on_scheduler_entry (bool)
| Entry notification. More...
virtual void | on_scheduler_exit (bool)
| Exit notification. More...
virtual | ~task_scheduler_observer_v3 ()
| Destructor automatically switches observation off if it is enabled.

## Friends
class | internal::task_scheduler_observer_v3
class | internal::observer_proxy
class | internal::observer_list

## Constructor & Destructor Documentation

tbb::interface6::task_scheduler_observer::task_scheduler_observer | ( | bool | local = `false`) |  |
| inline

Construct local or global observer in inactive state (observation disabled).

For a local observer entry/exit notifications are invoked whenever a worker thread joins/leaves the arena of the observer's owner thread. If a thread is already in the arena when the observer is activated, the entry notification is called before it executes the first stolen task. TODO: Obsolete. Global observer semantics is obsolete as it violates master thread isolation guarantees and is not composable. Thus the current default behavior of the constructor is obsolete too and will be changed in one of the future versions of the library.

tbb::interface6::task_scheduler_observer::task_scheduler_observer | ( | task_arena & | a) |  |
| inline

Construct local observer for a given arena in inactive state (observation disabled).

entry/exit notifications are invoked whenever a thread joins/leaves arena. If a thread is already in the arena when the observer is activated, the entry notification is called before it executes the first stolen task.

virtual tbb::interface6::task_scheduler_observer::~task_scheduler_observer | ( | ) |  |
| inline virtual

Destructor protects instance of the observer from concurrent notification. It is recommended to disable observation before destructor of a derived class starts, otherwise it can lead to concurrent notification callback on partly destroyed object

References observe().

## Member Function Documentation

virtual bool tbb::interface6::task_scheduler_observer::may_sleep | ( | ) |  |
| inline virtual

The callback can be invoked by a worker thread before it goes to sleep.

If it returns false ('keep_awake'), the thread will keep spinning and looking for work. It will not be called for master threads.

void tbb::interface6::task_scheduler_observer::observe | ( | bool | state = `true`) |  |
| inline

Enable or disable observation.

Warning: concurrent invocations of this method are not safe. Repeated calls with the same state are no-ops.

References tbb::internal::task_scheduler_observer_v3::observe(), and tbb::relaxed.

Referenced by ~task_scheduler_observer().

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

- task_scheduler_observer.h

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