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

Class base_task_graph. More...

#include <taskgraph.h>

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

Classes

struct  debug_container
 Struct debug_container More...
 
struct  persistent_container
 Struct persistent_container More...
 
class  task_queue_type
 
struct  transient_container
 Struct transient_container More...
 

Public Types

typedef base_task< TMemInterface > task_type
 
typedef std::basic_string< tchar_t, std::char_traits< tchar_t >, stl_allocator< tchar_t, TMemInterface > > string_type
 
typedef base_sub_graph< task_type, TMemInterface > sub_graph_type
 
typedef lock_free_node_dispenser< task_type *, TMemInterface > task_memory_allocator_type
 
typedef lock_free_queue< multi_producer_multi_consumer< task_type *, TMemInterface, task_memory_allocator_type >, typename base_task< TMemInterface >::task_type *, TMemInterface, task_memory_allocator_type *> base_task_queue_type
 
typedef std::unordered_map< string_type, task_type *, std::hash< string_type >, std::equal_to< string_type >, stl_allocator< std::pair< const string_type, task_type *>, TMemInterface > > task_name_to_task_map
 
typedef std::vector< sub_graph_type *, stl_allocator< sub_graph_type *, TMemInterface > > sub_graph_vector
 
typedef std::vector< task_type *, stl_allocator< task_type *, TMemInterface > > task_vector
 
typedef base_thread_pool< TMemInterface > thread_pool
 
typedef task_typetask_list
 
typedef std::function< void(task_type *, void *&) > traversal_function_type
 

Public Member Functions

 base_task_graph (thread_pool &_pool)
 Initializes a new instance of the base_task_graph class. More...
 
 ~base_task_graph ()
 Finalizes an instance of the base_task_graph class. More...
 
void setup (sub_graph_type *_sub_graph=nullptr)
 Setups the specified sub graph. More...
 
void load (string_type _file_name)
 Loads the specified file name. More...
 
void initialize ()
 Initializes this instance. More...
 
void set_task_thread_affinity (task_type *_task, uint64_t _mask)
 Sets the task thread affinity. More...
 
void set_task_thread_exclusion (task_type *_task, uint64_t _mask)
 Sets the task thread exclusion. More...
 
void set_num_workers (task_type *_task, thread_num_t _num_workers)
 Sets the number workers. More...
 
void set_percentage_of_workers (task_type *_task, float _percentage_workers)
 Sets the percentage of workers. More...
 
void setup_tail_kickers ()
 Setups the tail kickers. More...
 
void depth_first_visitor (task_type *_task, traversal_function_type _preorder_functor, traversal_function_type _inorder_functor, traversal_function_type _post_order_functor, traversal_function_type _tail_functor, void *_param, bool _bottom_up=false)
 Depthes the first visitor. More...
 
void kick ()
 Kicks this instance. More...
 
void queue_task (task_type *_task, thread_num_t _num_threads_to_wake_up=1)
 Queues the task. More...
 
task_typedequeue_task (uint32_t _priority)
 Dequeues the task. More...
 
bool is_task_available ()
 Determines whether [is task available]. More...
 
bool link_task (task_type *_parent_task, task_type *_dependent_task)
 Links the task. More...
 

Public Attributes

persistent_container persistent
 The persistent More...
 
transient_container transient
 The transient More...
 
debug_container debug
 The debug More...
 
thread_poolpool
 The pool More...
 

Detailed Description

template<class TMemInterface>
class task_scheduler::base_task_graph< TMemInterface >

Class base_task_graph.

See also
TMemInterface

Constructor & Destructor Documentation

◆ base_task_graph()

template<class TMemInterface >
task_scheduler::base_task_graph< TMemInterface >::base_task_graph ( thread_pool _pool)

Initializes a new instance of the base_task_graph class.

Parameters
_poolThe pool.

◆ ~base_task_graph()

template<class TMemInterface >
task_scheduler::base_task_graph< TMemInterface >::~base_task_graph ( )

Finalizes an instance of the base_task_graph class.

Member Function Documentation

◆ depth_first_visitor()

template<class TMemInterface >
void task_scheduler::base_task_graph< TMemInterface >::depth_first_visitor ( task_type _task,
traversal_function_type  _preorder_functor,
traversal_function_type  _inorder_functor,
traversal_function_type  _post_order_functor,
traversal_function_type  _tail_functor,
void *  _param,
bool  _bottom_up = false 
)

Depthes the first visitor.

Parameters
_taskThe task.
_preorder_functorThe preorder functor.
_inorder_functorThe inorder functor.
_post_order_functorThe post order functor.
_tail_functorThe tail functor.
_paramThe parameter.
_bottom_upThe bottom up.

◆ dequeue_task()

template<class TMemInterface >
base_task_graph< TMemInterface >::task_type * task_scheduler::base_task_graph< TMemInterface >::dequeue_task ( uint32_t  _priority)

Dequeues the task.

Parameters
_priorityThe priority.
Returns
task_type *.

◆ initialize()

template<class TMemInterface >
void task_scheduler::base_task_graph< TMemInterface >::initialize ( )

Initializes this instance.

◆ is_task_available()

template<class TMemInterface >
bool task_scheduler::base_task_graph< TMemInterface >::is_task_available ( )

Determines whether [is task available].

Returns
bool.

◆ kick()

template<class TMemInterface >
void task_scheduler::base_task_graph< TMemInterface >::kick ( )

Kicks this instance.

◆ link_task()

template<class TMemInterface >
bool task_scheduler::base_task_graph< TMemInterface >::link_task ( task_type _parent_task,
task_type _dependent_task 
)

Links the task.

Parameters
_parent_taskThe parent task.
_dependent_taskThe dependent task.
Returns
bool.

◆ load()

template<class TMemInterface >
void task_scheduler::base_task_graph< TMemInterface >::load ( string_type  _file_name)

Loads the specified file name.

Parameters
_file_nameName of the file.

◆ queue_task()

template<class TMemInterface >
void task_scheduler::base_task_graph< TMemInterface >::queue_task ( task_type _task,
thread_num_t  _num_threads_to_wake_up = 1 
)

Queues the task.

Parameters
_taskThe task.
_num_threads_to_wake_upThe number threads to wake up.

◆ set_num_workers()

template<class TMemInterface >
void task_scheduler::base_task_graph< TMemInterface >::set_num_workers ( task_type _task,
thread_num_t  _num_workers 
)

Sets the number workers.

Parameters
_taskThe task.
_num_workersThe number workers.

◆ set_percentage_of_workers()

template<class TMemInterface >
void task_scheduler::base_task_graph< TMemInterface >::set_percentage_of_workers ( task_type _task,
float  _percentage_workers 
)

Sets the percentage of workers.

Parameters
_taskThe task.
_percentage_workersThe percentage workers.

◆ set_task_thread_affinity()

template<class TMemInterface >
void task_scheduler::base_task_graph< TMemInterface >::set_task_thread_affinity ( task_type _task,
uint64_t  _mask 
)

Sets the task thread affinity.

Parameters
_taskThe task.
_maskThe mask.

◆ set_task_thread_exclusion()

template<class TMemInterface >
void task_scheduler::base_task_graph< TMemInterface >::set_task_thread_exclusion ( task_type _task,
uint64_t  _mask 
)

Sets the task thread exclusion.

Parameters
_taskThe task.
_maskThe mask.

◆ setup()

template<class TMemInterface >
void task_scheduler::base_task_graph< TMemInterface >::setup ( sub_graph_type _sub_graph = nullptr)

Setups the specified sub graph.

Parameters
_sub_graphThe sub graph.

◆ setup_tail_kickers()

template<class TMemInterface >
void task_scheduler::base_task_graph< TMemInterface >::setup_tail_kickers ( )

Setups the tail kickers.

Member Data Documentation

◆ debug

template<class TMemInterface >
debug_container task_scheduler::base_task_graph< TMemInterface >::debug

The debug

◆ persistent

template<class TMemInterface >
persistent_container task_scheduler::base_task_graph< TMemInterface >::persistent

The persistent

◆ pool

template<class TMemInterface >
thread_pool& task_scheduler::base_task_graph< TMemInterface >::pool

The pool

◆ transient

template<class TMemInterface >
transient_container task_scheduler::base_task_graph< TMemInterface >::transient

The transient


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