salsa  0.4.0
Salsa::TaskPool Class Reference


Base salsa TaskPool class More...

#include <TaskPool.hh>

Inheritance diagram for Salsa::TaskPool:
Salsa::Object

Public Member Functions

 TaskPool (NodeManager *pNM)
 
virtual ~TaskPool ()
 
void add (void *p, TaskState *t)
 
TaskStatefind (void *p) const
 
TaskStatefindById (uint32_t id) const
 
TaskStatefindFreeTask () const
 
void changeState (uint32_t id, TaskState::EState state)
 
uint32_t nSlotFree ()
 
bool terminateJob (Job *pJob)
 
bool handlePipe (void *pPipe)
 
void print (bool verbose=false) const
 

Static Public Member Functions

static std::shared_ptr< spdlog::logger > getConsoleOutput ()
 Get console output.
 
static void setConsoleLevel (spdlog::level::level_enum level)
 Sets console log level.
 

Protected Attributes

std::map< void *, TaskState * > mTasks {}
 List of task slots.
 
NodeManagermpNodeManager = nullptr
 Node manager.
 

Detailed Description

Constructor & Destructor Documentation

◆ TaskPool()

Salsa::TaskPool::TaskPool ( NodeManager pNM)


Constructor

Definition at line 7 of file TaskPool.cc.

◆ ~TaskPool()

Salsa::TaskPool::~TaskPool ( )
virtual


Destructor

Definition at line 13 of file TaskPool.cc.

References mTasks.

Member Function Documentation

◆ add()

void Salsa::TaskPool::add ( void *  p,
TaskState t 
)


Adds Task EState

Definition at line 24 of file TaskPool.cc.

References Salsa::TaskState::id(), and mTasks.

Referenced by Salsa::NodeManagerZyre::addTaskSlot().

◆ changeState()

void Salsa::TaskPool::changeState ( uint32_t  id,
TaskState::EState  state 
)


Change state for task with id

Definition at line 87 of file TaskPool.cc.

References mTasks.

Referenced by Salsa::Worker::onWhisper().

◆ find()

TaskState * Salsa::TaskPool::find ( void *  p) const


Returns TaskState /param p pointer

Definition at line 35 of file TaskPool.cc.

References mTasks.

Referenced by handlePipe().

◆ findById()

TaskState * Salsa::TaskPool::findById ( uint32_t  id) const


Returns task state by id

Definition at line 48 of file TaskPool.cc.

References mTasks.

Referenced by Salsa::Worker::onWhisper().

◆ findFreeTask()

TaskState * Salsa::TaskPool::findFreeTask ( ) const


Find avail slot in task pool

Definition at line 61 of file TaskPool.cc.

References mTasks.

Referenced by handlePipe(), and Salsa::Worker::onWhisper().

◆ handlePipe()

◆ nSlotFree()

uint32_t Salsa::TaskPool::nSlotFree ( )


Return n free slots

Definition at line 74 of file TaskPool.cc.

References mTasks.

◆ print()

void Salsa::TaskPool::print ( bool  verbose = false) const


Prints task pool info

Definition at line 128 of file TaskPool.cc.

References mTasks.

Referenced by handlePipe(), Salsa::Worker::onWhisper(), and Salsa::NodeManager::print().

◆ terminateJob()

bool Salsa::TaskPool::terminateJob ( Job pJob)


Kill all tasks from pJob

Definition at line 99 of file TaskPool.cc.

References mTasks, Salsa::Job::print(), and Salsa::Job::tasks().

Referenced by Salsa::NodeManager::terminateJob(), and Salsa::NodeManager::~NodeManager().


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