Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
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
inlineprivatevirtual

Reimplemented from tbb::internal::control_storage.

Definition at line 478 of file tbb_main.cpp.

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

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.

491  {
492  return my_head? my_active_value : 0;
493  }

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
inlineprivatevirtual

Reimplemented from tbb::internal::control_storage.

Definition at line 473 of file tbb_main.cpp.

473  {
474  __TBB_ASSERT( my_active_value>=1, NULL );
475  // -1 to take master into account
477  }

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
inlineprivatevirtual

Implements tbb::internal::control_storage.

Definition at line 467 of file tbb_main.cpp.

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

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
inlineprivatevirtual

Reimplemented from tbb::internal::control_storage.

Definition at line 470 of file tbb_main.cpp.

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

The documentation for this class was generated from the following file:
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
tbb::internal::governor::default_num_threads
static unsigned default_num_threads()
Definition: governor.h:84
tbb::internal::control_storage::my_active_value
size_t my_active_value
Definition: tbb_main.cpp:452
tbb::internal::allowed_parallelism_control::default_value
virtual size_t default_value() const __TBB_override
Definition: tbb_main.cpp:467
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::max_num_workers
static unsigned max_num_workers()
Definition: market.h:377
tbb::internal::control_storage::my_head
atomic< global_control * > my_head
Definition: tbb_main.cpp:453
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::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.