Added central control of threading.

This commit is contained in:
Pedro Pinto committed 2018-10-02 16:24:00 +00:00
1 parent ef3b39361a
commit 2769de6f7e
25 files changed
+259 -110

No files matched your search

+11 -11
View File
@@ -20,20 +20,20 @@ void test_ping_pong_mercury2()
ex2.init_neighbours(std::vector<Executor*> {&ex1});
ex1.spawn<Ping>();
ex1.spawn<Pong>();
//ex2.spawn<Pong>();
//ex1.spawn<Pong>();
ex2.spawn<Pong>();
// auto t = std::thread([&ex2]() {
// cpu_set_t cpuset;
// CPU_ZERO(&cpuset);
// CPU_SET(1, &cpuset);
// pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
auto t = std::thread([&ex2]() {
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(1, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
// while (true)
// ex2.do_work();
// });
while (true)
ex2.do_work();
});
// bts::sleep_for(2s);
bts::sleep_for(2s);
cpu_set_t cpuset;
CPU_ZERO(&cpuset);