hmbdc
simplify-high-performance-messaging-programming
changeSched.hpp
1 #include "hmbdc/app/Client.hpp"
2 #include "hmbdc/app/LoggerT.hpp"
3 #include "hmbdc/Exception.hpp"
4 #include "hmbdc/os/Thread.hpp"
5 
6 namespace hmbdc { namespace app { namespace utils {
7 
8 using namespace hmbdc::app;
9 
11 : Client<changeSched>
13  /*virtual*/
14  void
15  messageDispatchingStartedCb(uint16_t threadSerialNumber) override {
16  hmbdc::os::setCurrrentThreadSched(policy_, priority_);
17  throw hmbdc::ExitCode(0);
18  };
19  /*virtual*/
20  bool droppedCb() override {
21  delete this;
22  return true;
23  };
24 
25  static
26  auto& to(char const* policy, int priority) {
27  return *new changeSched(policy, priority);
28  }
29 
30 private:
31  changeSched(char const* policy, int priority)
32  : policy_(policy)
33  , priority_(priority)
34  {}
35 
36  char const* policy_;
37  int priority_;
38 
39 };
40 
41 
42 
43 }}}
Definition: Client.hpp:11
Definition: changeSched.hpp:10
Definition: Client.hpp:39
Definition: Exception.hpp:22
Definition: Client.hpp:11