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 struct changeSched
9 : Client<changeSched>
11  /*virtual*/
12  void
13  messageDispatchingStartedCb(uint16_t threadSerialNumber) override {
14  hmbdc::os::setCurrrentThreadSched(policy_, priority_);
15  throw hmbdc::ExitCode(0);
16  };
17  /*virtual*/
18  bool droppedCb() override {
19  delete this;
20  return true;
21  };
22 
23  static
24  auto& to(char const* policy, int priority) {
25  return *new changeSched(policy, priority);
26  }
27 
28 private:
29  changeSched(char const* policy, int priority)
30  : policy_(policy)
31  , priority_(priority)
32  {}
33 
34  char const* policy_;
35  int priority_;
36 
37 };
38 
39 
40 
41 }}}
a trait class, if a Client can only run on a single specific thread in Pool, derive the Client from i...
Definition: Client.hpp:17
Definition: changeSched.hpp:8
A Client represents a thread of execution/a task. The execution is managed by a Context. a Client object could participate in message dispatching as the receiver of specifed message types.
Definition: Client.hpp:47
Exception that just has an exit code.
Definition: Exception.hpp:28
Definition: Base.hpp:12