| Taskflow: A General-purpose Task-parallel Programming System

Loading...
Searching...
No Matches
interface.hpp
1#pragma once
2
3#include "../core/task.hpp"
4#include "../core/worker.hpp"
5
10
11 namespace tf {
12
13// ----------------------------------------------------------------------------
14// common observer types
15// ----------------------------------------------------------------------------
16
20 using observer_stamp_t = std::chrono::time_point<std::chrono::steady_clock>;
21
22// ----------------------------------------------------------------------------
23// ObserverInterface
24// ----------------------------------------------------------------------------
25
81 class ObserverInterface {
82
83 public:
84
88 virtual ~ObserverInterface() = default;
89
94 virtual void set_up(size_t num_workers) = 0;
95
101 virtual void on_entry(WorkerView wv, TaskView task_view) = 0;
102
108 virtual void on_exit(WorkerView wv, TaskView task_view) = 0;
109};
110
111} // end of namespace tf -----------------------------------------------------
tf::ObserverInterface
class to derive an executor observer
Definition interface.hpp:81
tf::ObserverInterface::set_up
virtual void set_up(size_t num_workers)=0
constructor-like method to call when the executor observer is fully created
tf::ObserverInterface::on_entry
virtual void on_entry(WorkerView wv, TaskView task_view)=0
method to call before a worker thread executes a closure
tf::ObserverInterface::on_exit
virtual void on_exit(WorkerView wv, TaskView task_view)=0
method to call after a worker thread executed a closure
tf::ObserverInterface::~ObserverInterface
virtual ~ObserverInterface()=default
virtual destructor
tf::TaskView
class to access task information from the observer interface
Definition task.hpp:1613
tf::WorkerView
class to create an immutable view of a worker
Definition worker.hpp:119
tf
taskflow namespace
Definition small_vector.hpp:20
tf::observer_stamp_t
std::chrono::time_point< std::chrono::steady_clock > observer_stamp_t
default time point type of observers
Definition interface.hpp:20