global_control.h
Go to the documentation of this file.
/*
Copyright (c) 2005-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef __TBB_global_control_H
#define __TBB_global_control_H
#include "tbb_stddef.h"
namespace tbb {
namespace interface9 {
class global_control {
public:
enum parameter {
max_allowed_parallelism,
thread_stack_size,
parameter_max // insert new parameters above this point
};
global_control(parameter p, size_t value) :
my_value(value), my_next(NULL), my_param(p) {
__TBB_ASSERT(my_param < parameter_max, "Invalid parameter");
#if __TBB_WIN8UI_SUPPORT && (_WIN32_WINNT < 0x0A00)
// For Windows 8 Store* apps it's impossible to set stack size
if (p==thread_stack_size)
return;
#elif __TBB_x86_64 && (_WIN32 || _WIN64)
if (p==thread_stack_size)
__TBB_ASSERT_RELEASE((unsigned)value == value, "Stack size is limited to unsigned int range");
#endif
if (my_param==max_allowed_parallelism)
__TBB_ASSERT_RELEASE(my_value>0, "max_allowed_parallelism cannot be 0.");
internal_create();
}
~global_control() {
__TBB_ASSERT(my_param < parameter_max, "Invalid parameter. Probably the object was corrupted.");
#if __TBB_WIN8UI_SUPPORT && (_WIN32_WINNT < 0x0A00)
// For Windows 8 Store* apps it's impossible to set stack size
if (my_param==thread_stack_size)
return;
#endif
internal_destroy();
}
static size_t active_value(parameter p) {
__TBB_ASSERT(p < parameter_max, "Invalid parameter");
return active_value((int)p);
}
private:
size_t my_value;
global_control *my_next;
parameter my_param;
void __TBB_EXPORTED_METHOD internal_create();
void __TBB_EXPORTED_METHOD internal_destroy();
static size_t __TBB_EXPORTED_FUNC active_value(int param);
};
} // namespace interface9
using interface9::global_control;
} // tbb
#endif // __TBB_global_control_H
__TBB_EXPORTED_FUNC
#define __TBB_EXPORTED_FUNC
Definition: scalable_allocator.h:38
tbb_stddef.h
__TBB_ASSERT_RELEASE
#define __TBB_ASSERT_RELEASE(predicate, message)
Definition: tbb_stddef.h:134
__TBB_EXPORTED_METHOD
#define __TBB_EXPORTED_METHOD
Definition: tbb_stddef.h:98
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
value
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
Definition: ittnotify_static.h:192
p
void const char const char int ITT_FORMAT __itt_group_sync p
Definition: ittnotify_static.h:91
tbb
The graph class.
Definition: serial/tbb/parallel_for.h:46
tbb::interface9::global_control
Definition: global_control.h:25
tbb::interface9::global_control::parameter
parameter
Definition: global_control.h:27
tbb::interface9::global_control::max_allowed_parallelism
@ max_allowed_parallelism
Definition: global_control.h:28
tbb::interface9::global_control::parameter_max
@ parameter_max
Definition: global_control.h:30
tbb::interface9::global_control::thread_stack_size
@ thread_stack_size
Definition: global_control.h:29
tbb::interface9::global_control::global_control
global_control(parameter p, size_t value)
Definition: global_control.h:33
tbb::interface9::global_control::active_value
static size_t active_value(parameter p)
Definition: global_control.h:59
tbb::interface9::global_control::internal_destroy
void __TBB_EXPORTED_METHOD internal_destroy()
Definition: tbb_main.cpp:539
tbb::interface9::global_control::internal_create
void __TBB_EXPORTED_METHOD internal_create()
Definition: tbb_main.cpp:523
tbb::interface9::global_control::my_value
size_t my_value
Definition: global_control.h:64
tbb::interface9::global_control::my_next
global_control * my_next
Definition: global_control.h:65
tbb::interface9::global_control::~global_control
~global_control()
Definition: global_control.h:49
tbb::interface9::global_control::my_param
parameter my_param
Definition: global_control.h:66

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