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

+4 -2
View File
@@ -9,6 +9,7 @@
#include "lib/utils/bts_chrono.h"
#include "lib/utils/datetime.h"
#include "lib/utils/file_utils.h"
#include "lib/utils/thread_manager.h"
#include <boost/date_time.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
@@ -204,7 +205,9 @@ FIXFileStore::FIXFileStore(config::JetFIX::Connection const &cfg,
}
}
me->fix_store.open(fix_log_p, std::ofstream::app);
me->writer_thread = std::thread(std::bind(&FIXFileStore::write, this));
auto thread_name = fmt::format("jf_store_{}", me->cfg.name().c_str());
me->writer_thread = threading::make_thread(
thread_name, std::bind(&FIXFileStore::write, this));
}
}
@@ -270,7 +273,6 @@ void FIXFileStore::set_last_seq_num(uint32_t last_seq_num) {
void FIXFileStore::write() {
Event ev;
os::set_thread_name(fmt::format("{0}_store", me->cfg.name()).c_str());
while (true)
if (me->event_queue.try_pop(ev)) {