Lockless Task Scheduler  v1.0a
A lockless task scheduler
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
task_scheduler::base_thread_pool< TMemInterface > Class Template Reference

Class base_thread_pool. More...

#include <threadpool.h>

Collaboration diagram for task_scheduler::base_thread_pool< TMemInterface >:
Collaboration graph
[legend]

Classes

struct  setup_container
 Struct setup_container More...
 

Public Types

enum  state_selector { run = 0, request_pause, request_stop }
 Enum state_selector More...
 

Public Member Functions

 base_thread_pool (thread_num_t _num_threads=max_num_threads)
 Initializes a new instance of the base_thread_pool class. More...
 
void start (task_graph_type &task_graph)
 Starts the specified task graph. More...
 
void stop ()
 Stops this instance. More...
 
void wake_up (thread_num_t _num_threads_to_wake_up=max_num_threads, uint64_t _thread_affinity_mask=std::numeric_limits< uint64_t >::max())
 Wakes up. More...
 
thread_typeget_current_thread ()
 Gets the current thread. More...
 

Public Attributes

setup_container setup
 The setup More...
 
thread_num_t num_threads
 The number threads More...
 
task_graph_typetask_graph
 The task graph More...
 
thread_typethreads [max_num_threads]
 
task_memory_allocator_type task_memory_allocator
 The threads More...
 
std::atomic< uint32_t > num_working
 The number working More...
 
optimization std::atomic< typename task_type::rank_type > queue_rank [task_type::num_priority][max_num_threads]
 

Detailed Description

template<class TMemInterface>
class task_scheduler::base_thread_pool< TMemInterface >

Class base_thread_pool.

Member Enumeration Documentation

◆ state_selector

template<class TMemInterface >
enum task_scheduler::base_thread_pool::state_selector

Enum state_selector

Constructor & Destructor Documentation

◆ base_thread_pool()

template<class TMemInterface >
task_scheduler::base_thread_pool< TMemInterface >::base_thread_pool ( thread_num_t  _num_threads = max_num_threads)

Initializes a new instance of the base_thread_pool class.

Parameters
_num_threadsThe number threads.

Member Function Documentation

◆ get_current_thread()

template<class TMemInterface >
base_thread_pool< TMemInterface >::thread_type * task_scheduler::base_thread_pool< TMemInterface >::get_current_thread ( )

Gets the current thread.

Returns
thread_type *.

◆ start()

template<class TMemInterface >
void task_scheduler::base_thread_pool< TMemInterface >::start ( task_graph_type task_graph)

Starts the specified task graph.

Parameters
task_graphThe task graph.

◆ stop()

template<class TMemInterface >
void task_scheduler::base_thread_pool< TMemInterface >::stop ( )

Stops this instance.

◆ wake_up()

template<class TMemInterface >
void task_scheduler::base_thread_pool< TMemInterface >::wake_up ( thread_num_t  _num_threads_to_wake_up = max_num_threads,
uint64_t  _thread_affinity_mask = std::numeric_limits<uint64_t>::max() 
)

Wakes up.

Parameters
num_threads_to_wake_upThe number threads to wake up.

Member Data Documentation

◆ num_threads

template<class TMemInterface >
thread_num_t task_scheduler::base_thread_pool< TMemInterface >::num_threads

The number threads

◆ num_working

template<class TMemInterface >
std::atomic< uint32_t > task_scheduler::base_thread_pool< TMemInterface >::num_working

The number working

◆ setup

template<class TMemInterface >
setup_container task_scheduler::base_thread_pool< TMemInterface >::setup

The setup

◆ task_graph

template<class TMemInterface >
task_graph_type* task_scheduler::base_thread_pool< TMemInterface >::task_graph

The task graph

◆ task_memory_allocator

template<class TMemInterface >
task_memory_allocator_type task_scheduler::base_thread_pool< TMemInterface >::task_memory_allocator

The threads


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