Pothos  0.2.1-g9f04573d
The Pothos dataflow programming software suite
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Public Member Functions | Public Attributes | List of all members
Pothos::ThreadPoolArgs Class Reference

#include <ThreadPool.hpp>

Public Member Functions

 ThreadPoolArgs (void)
 Create a default ThreadPoolArgs. More...
 
 ThreadPoolArgs (const size_t numThreads)
 Create a ThreadPoolArgs given a specific number of threads. More...
 
 ThreadPoolArgs (const std::string &json)
 

Public Attributes

size_t numThreads
 
double priority
 
std::string affinityMode
 
std::vector< size_t > affinity
 A list of CPUs or NUMA nodes (depends on mode setting) More...
 
std::string yieldMode
 

Detailed Description

Arguments used to configure a ThreadPool.

Constructor & Destructor Documentation

Pothos::ThreadPoolArgs::ThreadPoolArgs ( void  )

Create a default ThreadPoolArgs.

Pothos::ThreadPoolArgs::ThreadPoolArgs ( const size_t  numThreads)

Create a ThreadPoolArgs given a specific number of threads.

Pothos::ThreadPoolArgs::ThreadPoolArgs ( const std::string &  json)

Create a ThreadPoolArgs from a JSON description. All fields are optional and have defined defaults.

Example JSON markup for a ThreadPoolArgs description:

{
"numThreads" : 2,
"priority" : 0.5,
"affinityMode" : "CPU",
"affinity" : [0, 2, 4, 6],
"yieldMode" : "SPIN"
}
Parameters
jsona JSON object markup string

Member Data Documentation

std::vector<size_t> Pothos::ThreadPoolArgs::affinity

A list of CPUs or NUMA nodes (depends on mode setting)

std::string Pothos::ThreadPoolArgs::affinityMode

The affinity mode for this thread pool. The affinityMode string can have the following values:

  • "ALL" - affinitize to all avilable CPUs
  • "CPU" - affinity list specifies CPUs
  • "NUMA" - affinity list specifies NUMA nodes

The default is "ALL".

size_t Pothos::ThreadPoolArgs::numThreads

The number of threads to create in this pool. The default value is 0, indicating the thread-per-block mechanic. Positive values for numThreads indicate the thread-pool mechanic.

double Pothos::ThreadPoolArgs::priority

Scheduling priority for all threads in the pool. The value can be in range -1.0 to 1.0. A value of 0.0 is the default thread scheduling. Positive values enable realtime scheduling mode. Negative values enable sub-priority scheduling.

The default is 0.0 (normal).

std::string Pothos::ThreadPoolArgs::yieldMode

The yieldMode specifies the internal threading mechanisms:

  • "CONDITION" - Threads wait on condition variables when no work is available.
  • "HYBRID" - Threads spin for a while, then yield to other threads, when no work is available.
  • "SPIN" - Threads busy-wait, without yielding, when no work is available.

The default is "CONDITION".


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