Hedgehog  3.1.0
A library to generate hybrid pipeline workflow systems
Loading...
Searching...
No Matches
hh::DefaultScheduler Class Reference

Default scheduler use in Hedgehog graph. More...

#include "default_scheduler.h"

Inheritance diagram for hh::DefaultScheduler:
Inheritance graph
Collaboration diagram for hh::DefaultScheduler:
Collaboration graph

Public Member Functions

 DefaultScheduler ()
 Default constructor.
 
 ~DefaultScheduler () override=default
 Default destructor.
 
std::unique_ptr< Schedulercreate () const override
 Definition of virtual constructor.
 
void spawnThreads (std::set< core::abstraction::NodeAbstraction * > const &cores, bool waitForInitialization) override
 Spawn the threads for all graph's nodes.
 
void joinAll () override
 Wait for all inside nodes to join and join the threads of all inside graphs.
 
- Public Member Functions inherited from hh::Scheduler
 Scheduler ()=default
 Scheduler default constructor.
 
virtual ~Scheduler ()=default
 Scheduler default destructor.
 
virtual std::unique_ptr< Schedulercreate () const =0
 Definition of virtual constructor.
 
virtual void spawnThreads (std::set< core::abstraction::NodeAbstraction * > const &cores, bool waitForInitialization)=0
 Spawn the threads of a graph.
 
virtual void joinAll ()=0
 Method waiting for all graph's threads termination, called when Graph::waitForTermination() is called.
 

Private Attributes

std::unique_ptr< std::vector< std::thread > > const threads_ = nullptr
 Vector of threads for the graph nodes.
 
std::unique_ptr< std::vector< core::abstraction::GraphNodeAbstraction * > > innerGraphs_ = nullptr
 Scheduler's graph.
 

Detailed Description

Default scheduler use in Hedgehog graph.

By default, each node that needs a thread gets a thread and management of these threads is left to the OS.

Definition at line 38 of file default_scheduler.h.

Constructor & Destructor Documentation

◆ DefaultScheduler()

hh::DefaultScheduler::DefaultScheduler ( )
inline

Default constructor.

Definition at line 48 of file default_scheduler.h.

◆ ~DefaultScheduler()

hh::DefaultScheduler::~DefaultScheduler ( )
overridedefault

Default destructor.

Member Function Documentation

◆ create()

std::unique_ptr< Scheduler > hh::DefaultScheduler::create ( ) const
inlineoverridevirtual

Definition of virtual constructor.

Returns
New instance of DefaultScheduler

Implements hh::Scheduler.

Definition at line 57 of file default_scheduler.h.

◆ joinAll()

void hh::DefaultScheduler::joinAll ( )
inlineoverridevirtual

Wait for all inside nodes to join and join the threads of all inside graphs.

Implements hh::Scheduler.

Definition at line 96 of file default_scheduler.h.

◆ spawnThreads()

void hh::DefaultScheduler::spawnThreads ( std::set< core::abstraction::NodeAbstraction * > const &  cores,
bool  waitForInitialization 
)
inlineoverridevirtual

Spawn the threads for all graph's nodes.

Parameters
coresGraph's inside nodes
waitForInitializationWait for internal nodes to be initialized flags
Exceptions
std::runtime_errorif a thread cannot be created, or if the core is malformed

If asked, wait for all internals to be initialized before returning

Implements hh::Scheduler.

Definition at line 63 of file default_scheduler.h.

Here is the call graph for this function:

Member Data Documentation

◆ innerGraphs_

std::unique_ptr<std::vector<core::abstraction::GraphNodeAbstraction *> > hh::DefaultScheduler::innerGraphs_ = nullptr
private

Scheduler's graph.

Definition at line 44 of file default_scheduler.h.

◆ threads_

std::unique_ptr<std::vector<std::thread> > const hh::DefaultScheduler::threads_ = nullptr
private

Vector of threads for the graph nodes.

Definition at line 41 of file default_scheduler.h.