Switch tbb::queueing_mutex to std::mutex

This commit is contained in:
Eric Harding committed 2018-11-12 13:57:23 -05:00
1 parent 1a6a10a834
commit c834a6e840
2 files changed
+5 -6

No files matched your search

+3 -3
View File
@@ -102,7 +102,7 @@ private:
//
MDProducer::MDProducer(Platform platform, bool shared) :
_mutex(new Mutex()),
_mutex(new std::mutex()),
_producers(),
_platform(platform),
_shared(shared)
@@ -143,7 +143,7 @@ MDProducerImpl& MDProducer::get_producer(const char* symbol, SecurityType type,
MDProducerHandle MDProducer::add_security(const FixedSecurity& security) {
bts_assert_d(strlen(security.symbol()) > 0);
bts_assert(security.size >= sizeof(FixedSecurity));
Mutex::scoped_lock lock(*_mutex);
std::lock_guard<std::mutex> lock(*_mutex);
auto& impl = get_producer(security.symbol(), security.type, security.exchange);
auto result = impl.add_security(security);
if (security.key != invalid_security_key) { result.set_key(security.key); }
@@ -151,7 +151,7 @@ MDProducerHandle MDProducer::add_security(const FixedSecurity& security) {
}
MDProducerChannel MDProducer::get_channel(const char* symbol, SecurityType type, Venue exchange) {
Mutex::scoped_lock lock(*_mutex);
std::lock_guard<std::mutex> lock(*_mutex);
return MDProducerChannel(get_producer(symbol, type, exchange));
}
+2 -3
View File
@@ -7,9 +7,9 @@
#include "MDProducerHandle.h"
#include "MDProducerChannel.h"
#include "Shm/FixedSecurity.h"
#include "tbb/queuing_mutex.h"
#include <vector>
#include <memory>
#include <mutex>
namespace bts {
namespace md {
@@ -39,8 +39,7 @@ private:
MDProducerImpl& get_producer(const char* symbol, SecurityType type, Venue exchange);
typedef tbb::queuing_mutex Mutex;
std::unique_ptr<Mutex> _mutex;
std::unique_ptr<std::mutex> _mutex;
std::vector<std::unique_ptr<MDProducerImpl>> _producers;
Platform _platform;
bool _shared;