# task_scheduler_observer

## Summary

Class that represents thread's interest in task scheduling services.

## Syntax

    class task_scheduler_observer;

## Header

    #include "tbb/task_scheduler_observer.h"

## Description

A `task_scheduler_observer` permits clients to observe when a thread starts or stops participating in task scheduling (globally). You typically derive your own observer class from task_scheduler_observer, and override virtual methods `on_scheduler_entry` or `on_scheduler_exit`. An instance has a state observing or not observing. Remember to call `observe()` to enable observation.

## Members

    namespace tbb {
        class task_scheduler_observer {
        public:
            task_scheduler_observer();
            virtual ~task_scheduler_observer();
            void observe( bool state=true );
            bool is_observing() const;
            virtual void on_scheduler_entry( bool is_worker ) {}
            virtual void on_scheduler_exit( bool is_worker } {}
        };
      }

Parent topic: Task Scheduler

- task_scheduler_observer Members