task_scheduler_observer.h Source File

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

- File List
- File Members

# task_scheduler_observer.h

    00001 /*
    00002     Copyright 2005-2010 Intel Corporation.  All Rights Reserved.
    00003
    00004     The source code contained or described herein and all documents related
    00005     to the source code ("Material") are owned by Intel Corporation or its
    00006     suppliers or licensors.  Title to the Material remains with Intel
    00007     Corporation or its suppliers and licensors.  The Material is protected
    00008     by worldwide copyright laws and treaty provisions.  No part of the
    00009     Material may be used, copied, reproduced, modified, published, uploaded,
    00010     posted, transmitted, distributed, or disclosed in any way without
    00011     Intel's prior express written permission.
    00012
    00013     No license under any patent, copyright, trade secret or other
    00014     intellectual property right is granted to or conferred upon you by
    00015     disclosure or delivery of the Materials, either expressly, by
    00016     implication, inducement, estoppel or otherwise.  Any license under such
    00017     intellectual property rights must be express and approved by Intel in
    00018     writing.
    00019 */
    00020
    00021 #ifndef __TBB_task_scheduler_observer_H
    00022 #define __TBB_task_scheduler_observer_H
    00023
    00024 #include "atomic.h"
    00025
    00026 #if __TBB_SCHEDULER_OBSERVER
    00027
    00028 namespace tbb {
    00029
    00030 namespace internal {
    00031
    00032 class observer_proxy;
    00033
    00034 class task_scheduler_observer_v3 {
    00035     friend class observer_proxy;
    00036     observer_proxy* my_proxy;
    00037     atomic<intptr_t> my_busy_count;
    00038 public:
    00040     void __TBB_EXPORTED_METHOD observe( bool state=true );
    00041
    00043     bool is_observing() const {return my_proxy!=NULL;}
    00044
    00046     task_scheduler_observer_v3() : my_proxy(NULL) {my_busy_count=0;}
    00047
    00049     virtual void on_scheduler_entry( bool /*is_worker*/ ) {}
    00050
    00052     virtual void on_scheduler_exit( bool /*is_worker*/ ) {}
    00053
    00055     virtual ~task_scheduler_observer_v3() {observe(false);}
    00056 };
    00057
    00058 } // namespace internal
    00059
    00060 typedef internal::task_scheduler_observer_v3 task_scheduler_observer;
    00061
    00062 } // namespace tbb
    00063
    00064 #endif /* __TBB_SCHEDULER_OBSERVER */
    00065
    00066 #endif /* __TBB_task_scheduler_observer_H */

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