Lockless Task Scheduler  v1.0a
A lockless task scheduler
Classes | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
task_scheduler::base_data_task< TMemInterface, TDataType > Class Template Reference
Inheritance diagram for task_scheduler::base_data_task< TMemInterface, TDataType >:
Inheritance graph
[legend]
Collaboration diagram for task_scheduler::base_data_task< TMemInterface, TDataType >:
Collaboration graph
[legend]

Public Member Functions

 base_data_task (typename super::task_graph_type &_task_graph, size_t _max_data_parallel_workload=0)
 Initializes a new instance of the base_task class. More...
 
 ~base_data_task ()
 Finalizes an instance of the base_task class. More...
 
bool add_data_parallel_work (typename data_vector::iterator _begin, typename data_vector::iterator _end)
 Add data parallel work class. More...
 
- Public Member Functions inherited from task_scheduler::base_task< TMemInterface >
 base_task (task_graph_type &_task_graph)
 Initializes a new instance of the base_task class. More...
 
virtual ~base_task ()
 Finalizes an instance of the base_task class. More...
 
void set_thread_affinity (thread_mask_int_t _mask)
 Sets the thread affinity. More...
 
void set_thread_exclusion (thread_mask_int_t _mask)
 Sets the thread exclusion. More...
 
void set_num_workers (thread_num_t _num_workers)
 Sets the number workers. More...
 
void set_num_workers (percentage_t _percentage_workers)
 Sets the number workers. More...
 
void kick_dependent_tasks ()
 Kicks the dependent tasks. More...
 
bool add_task_parallel_work (function_type _work_function)
 Adds the task parallel work. More...
 
bool link_task (task_type *_next_task)
 Links the task. More...
 
bool operator() ()
 Operator()s this instance. More...
 

Public Attributes

transient_data_container data_transient
 The transient More...
 
- Public Attributes inherited from task_scheduler::base_task< TMemInterface >
debug_container debug
 The debug More...
 
transient_container transient
 The transient More...
 
persistent_container persistent
 The persistent More...
 
task_graph_typetask_graph
 The task graph More...
 
thread_unsafe_access_storage add_task_parallel_work_detector
 The add task parallel work detector More...
 

Protected Member Functions

bool run () override
 Callback to run task More...
 
void before_scheduled (thread_num_t _scheduled_on_num_workers) override
 Callback is called when a task is scheduled More...
 
void after_run () override
 Callback is called after a task is run More...
 
virtual thread_num_t get_recommended_num_workers () override
 Gets the best number of workers for the task every frame More...
 

Additional Inherited Members

- Public Types inherited from task_scheduler::base_task< TMemInterface >
enum  priority_selector {
  realtime, high, normal, low,
  num_priority
}
 Enum priority_selector More...
 
typedef base_task< TMemInterface > task_type
 
typedef base_thread< TMemInterface > thread_type
 
typedef base_task_graph< TMemInterface > task_graph_type
 
typedef base_sub_graph< task_type, TMemInterface > sub_graph_type
 
typedef std::basic_string< tchar_t, std::char_traits< tchar_t >, stl_allocator< tchar_t, TMemInterface > > string_type
 
typedef std::vector< string_type, stl_allocator< string_type, TMemInterface > > string_vector
 
typedef std::vector< task_type *, stl_allocator< task_type *, TMemInterface > > task_vector
 
typedef base_thread_pool< TMemInterface > thread_pool
 
typedef std::function< void() > function_type
 
typedef int64_t rank_type
 
typedef std::vector< function_type > task_work_vector
 
typedef thread_index_t< TMemInterface > thread_index_type
 
typedef lock_free_node_dispenser< function_type *, TMemInterface > work_memory_allocator_type
 
typedef lock_free_queue< multi_producer_multi_consumer< function_type *, TMemInterface, work_memory_allocator_type >, function_type *, TMemInterface, work_memory_allocator_type *> work_queue_type
 

Constructor & Destructor Documentation

◆ base_data_task()

template<class TMemInterface , class TDataType >
task_scheduler::base_data_task< TMemInterface, TDataType >::base_data_task ( typename super::task_graph_type _task_graph,
size_t  _max_data_parallel_workload = 0 
)

Initializes a new instance of the base_task class.

Parameters
_task_graphThe task graph.

◆ ~base_data_task()

template<class TMemInterface , class TDataType >
task_scheduler::base_data_task< TMemInterface, TDataType >::~base_data_task ( )

Finalizes an instance of the base_task class.

Member Function Documentation

◆ add_data_parallel_work()

template<class TMemInterface , class TDataType >
bool task_scheduler::base_data_task< TMemInterface, TDataType >::add_data_parallel_work ( typename data_vector::iterator  _begin,
typename data_vector::iterator  _end 
)

Add data parallel work class.

Parameters
_beginIterator to the start of a range of elements to add
_beginIterator to the end of a range of elements to add

◆ after_run()

template<class TMemInterface , class TDataType >
void task_scheduler::base_data_task< TMemInterface, TDataType >::after_run ( )
overrideprotectedvirtual

Callback is called after a task is run

Reimplemented from task_scheduler::base_task< TMemInterface >.

◆ before_scheduled()

template<class TMemInterface , class TDataType >
void task_scheduler::base_data_task< TMemInterface, TDataType >::before_scheduled ( thread_num_t  _scheduled_on_num_workers)
overrideprotectedvirtual

Callback is called when a task is scheduled

Reimplemented from task_scheduler::base_task< TMemInterface >.

◆ get_recommended_num_workers()

template<class TMemInterface , class TDataType >
thread_num_t task_scheduler::base_data_task< TMemInterface, TDataType >::get_recommended_num_workers ( )
overrideprotectedvirtual

Gets the best number of workers for the task every frame

Parameters
_num_workersThe number workers.

Reimplemented from task_scheduler::base_task< TMemInterface >.

◆ run()

template<class TMemInterface , class TDataType >
bool task_scheduler::base_data_task< TMemInterface, TDataType >::run ( )
overrideprotectedvirtual

Callback to run task

Implements task_scheduler::base_task< TMemInterface >.

Member Data Documentation

◆ data_transient

template<class TMemInterface , class TDataType >
transient_data_container task_scheduler::base_data_task< TMemInterface, TDataType >::data_transient

The transient


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