task_scheduler_init.h Source File

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

- File List
- File Members

# task_scheduler_init.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_init_H
    00022 #define __TBB_task_scheduler_init_H
    00023
    00024 #include "tbb_stddef.h"
    00025
    00026 namespace tbb {
    00027
    00028 typedef std::size_t stack_size_type;
    00029
    00031 namespace internal {
    00033
    00034     class scheduler;
    00035 } // namespace internal
    00037
    00039
    00042 class task_scheduler_init: internal::no_copy {
    00044     internal::scheduler* my_scheduler;
    00045 public:
    00046
    00048     static const int automatic = -1;
    00049
    00051     static const int deferred = -2;
    00052
    00054
    00062     void __TBB_EXPORTED_METHOD initialize( int number_of_threads=automatic );
    00063
    00065
    00066     void __TBB_EXPORTED_METHOD initialize( int number_of_threads, stack_size_type thread_stack_size );
    00067
    00069     void __TBB_EXPORTED_METHOD terminate();
    00070
    00072     task_scheduler_init( int number_of_threads=automatic, stack_size_type thread_stack_size=0 ) : my_scheduler(NULL)  {
    00073         initialize( number_of_threads, thread_stack_size );
    00074     }
    00075
    00077     ~task_scheduler_init() {
    00078         if( my_scheduler )
    00079             terminate();
    00080         internal::poison_pointer( my_scheduler );
    00081     }
    00083
    00100     static int __TBB_EXPORTED_FUNC default_num_threads ();
    00101
    00103     bool is_active() const { return my_scheduler != NULL; }
    00104 };
    00105
    00106 } // namespace tbb
    00107
    00108 #endif /* __TBB_task_scheduler_init_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.