tbb::internal::allowed_parallelism_control Class Reference
Inheritance diagram for tbb::internal::allowed_parallelism_control:
Collaboration diagram for tbb::internal::allowed_parallelism_control:

## Public Member Functions

size_t | active_value_if_present () const

## Private Member Functions

virtual size_t | default_value () const __TBB_override
virtual bool | is_first_arg_preferred (size_t a, size_t b) const __TBB_override
virtual void | apply_active () const __TBB_override
virtual size_t | active_value () const __TBB_override

## Additional Inherited Members

Public Attributes inherited from tbb::internal::padded_base< control_storage, NFS_MaxLineSize, sizeof(control_storage) % NFS_MaxLineSize >
char | pad [S - R]
Protected Attributes inherited from tbb::internal::control_storage
size_t | my_active_value
atomic< global_control * > | my_head
spin_mutex | my_list_mutex

## Detailed Description

Definition at line 466 of file tbb_main.cpp.

## Member Function Documentation

## active_value()

virtual size_t tbb::internal::allowed_parallelism_control::active_value | ( |  | ) | const

inline private virtual

Reimplemented from tbb::internal::control_storage.

Definition at line 478 of file tbb_main.cpp.

{
/* Reading of my_active_value is not synchronized with possible updating
of my_head by other thread. It's ok, as value of my_active_value became
not invalid, just obsolete. */
if (!my_head)
return default_value();
// non-zero, if market is active
const size_t workers = market::max_num_workers();
// We can't exceed market's maximal number of workers.
// +1 to take master into account
return workers? min(workers+1, my_active_value): my_active_value;
}

References default_value(), tbb::internal::market::max_num_workers(), tbb::internal::min(), tbb::internal::control_storage::my_active_value, and tbb::internal::control_storage::my_head.

Here is the call graph for this function:

## active_value_if_present()

size_t tbb::internal::allowed_parallelism_control::active_value_if_present | ( |  | ) | const

inline

Definition at line 491 of file tbb_main.cpp.

{
return my_head? my_active_value : 0;
}

References tbb::internal::control_storage::my_active_value, and tbb::internal::control_storage::my_head.

Referenced by tbb::internal::market::app_parallelism_limit().

Here is the caller graph for this function:

## apply_active()

virtual void tbb::internal::allowed_parallelism_control::apply_active | ( |  | ) | const

inline private virtual

Reimplemented from tbb::internal::control_storage.

Definition at line 473 of file tbb_main.cpp.

{
__TBB_ASSERT( my_active_value>=1, NULL );
// -1 to take master into account
market::set_active_num_workers( my_active_value-1 );
}

References __TBB_ASSERT, tbb::internal::control_storage::my_active_value, and tbb::internal::market::set_active_num_workers().

Here is the call graph for this function:

## default_value()

virtual size_t tbb::internal::allowed_parallelism_control::default_value | ( |  | ) | const

inline private virtual

Implements tbb::internal::control_storage.

Definition at line 467 of file tbb_main.cpp.

{
return max(1U, governor::default_num_threads());
}

References tbb::internal::governor::default_num_threads(), and tbb::internal::max().

Referenced by active_value().

Here is the call graph for this function:
Here is the caller graph for this function:

## is_first_arg_preferred()

virtual bool tbb::internal::allowed_parallelism_control::is_first_arg_preferred | ( | size_t | a,
|  | size_t | b
| ) |  | const

inline private virtual

Reimplemented from tbb::internal::control_storage.

Definition at line 470 of file tbb_main.cpp.

{
return a<b; // prefer min allowed parallelism
}

The documentation for this class was generated from the following file:

- tbb_main.cpp

tbb::internal::control_storage::my_active_value
size_t my_active_value
Definition: tbb_main.cpp:452
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
tbb::internal::allowed_parallelism_control::default_value
virtual size_t default_value() const __TBB_override
Definition: tbb_main.cpp:467
tbb::internal::governor::default_num_threads
static unsigned default_num_threads()
Definition: governor.h:84
tbb::internal::control_storage::my_head
atomic< global_control * > my_head
Definition: tbb_main.cpp:453
tbb::internal::max
T max(const T &val1, const T &val2)
Utility template function returning greater of the two values.
Definition: tbb_misc.h:119
tbb::internal::market::set_active_num_workers
static void set_active_num_workers(unsigned w)
Set number of active workers.
Definition: market.cpp:235
tbb::internal::market::max_num_workers
static unsigned max_num_workers()
Definition: market.h:377
tbb::internal::min
T min(const T &val1, const T &val2)
Utility template function returning lesser of the two values.
Definition: tbb_misc.h:110

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.