[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/slacy/taskflow/master/examples/worker_interface.cpp [Back]  [Original]

// This program demonstrates how to change the worker behavior
// upon the creation of an executor.

#include 

class CustomWorkerBehavior : public tf::WorkerInterface {

  public:
  
  // to call before the worker enters the scheduling loop
  void scheduler_prologue(tf::Worker& w) override {
    std::cout native_handle(), ") enters scheduler\n"
    ); 
  }

  // to call after the worker leaves the scheduling loop
  void scheduler_epilogue(tf::Worker& w, std::exception_ptr) override {
    std::cout native_handle(), ") leaves scheduler\n"
    ); 
  }
};

int main() {

  tf::Executor executor(4, std::make_shared());
  
  return 0;
}

Web Proxy Viewer  |  New URL  |  Original Page