Added central control of threading.
This commit is contained in:
1 parent
ef3b39361a
commit
2769de6f7e
25 files changed
+259
-110
No files matched your search
@@ -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);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "server/sparkd/user/AdminServiceServer.h"
|
||||
#include "server/sparkd/user/UserServiceServer.h"
|
||||
#include "server/sparkd/position/PositionServiceServer.h"
|
||||
#include "lib/utils/thread_manager.h"
|
||||
|
||||
#include "lib/md/relay/QueryServer.h"
|
||||
|
||||
@@ -63,11 +64,8 @@ int Run::execute(std::vector<std::string> const &) {
|
||||
utils::DispatcherTimer timer(utils::Dispatcher::background(), 5000, [=]() { bg_health->increment(); });
|
||||
timer.start();
|
||||
stats.publish(bg_health);
|
||||
|
||||
std::thread([]() {
|
||||
os::set_thread_name("ExchangeSim");
|
||||
sim::start_exchange_sim();
|
||||
}).detach();
|
||||
|
||||
threading::make_thread("ExchangeSim", []() {sim::start_exchange_sim();}).detach();
|
||||
|
||||
std::this_thread::sleep_until(
|
||||
std::chrono::time_point<std::chrono::system_clock>::max());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "lib/os/os.h"
|
||||
#include "lib/utils/thread_manager.h"
|
||||
#include "lib/utils/init_spark_lib.h"
|
||||
#include "server/sparkd/cmds/CmdRegistry.h"
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
int main(int argc, char **argv) {
|
||||
using namespace bts;
|
||||
|
||||
os::set_thread_name("main");
|
||||
|
||||
utils::init_spark_lib();
|
||||
|
||||
BEGIN_CMD;
|
||||
REGISTER(Test);
|
||||
REGISTER(Help);
|
||||
|
||||
Reference in new issue
Block a user