00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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 }
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 initialize( int number_of_threads=automatic );
00063
00065
00066 void initialize( int number_of_threads, stack_size_type thread_stack_size );
00067
00069 void 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
00090 static int default_num_threads ();
00091 };
00092
00093 }
00094
00095 #endif