From cd15ad88cd8cf1a15d25ba4ef8371dfbb10c1e92 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sat, 28 Jan 2017 19:22:39 +0100 Subject: [PATCH] [IPC] Use first worker --- src/Utils/IPC.cpp | 21 +-------------------- src/Utils/IPC.hpp | 1 - 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/Utils/IPC.cpp b/src/Utils/IPC.cpp index d1ad2fbe..5dd7d98d 100644 --- a/src/Utils/IPC.cpp +++ b/src/Utils/IPC.cpp @@ -9,7 +9,7 @@ namespace Utils if(this->remove) boost::interprocess::message_queue::remove(this->name.data()); queue.reset(new boost::interprocess::message_queue(boost::interprocess::open_or_create, this->name.data(), _queueSize, _bufferSize + sizeof(Channel::Header))); - this->queueThread = std::thread(&Channel::queueWorker2, this); + this->queueThread = std::thread(&Channel::queueWorker, this); } Channel::~Channel() @@ -113,25 +113,6 @@ namespace Utils } } - void Channel::queueWorker2() - { - while (!this->terminateQueue) - { - if(!this->internalQueue.empty()) - { - std::lock_guard lock(this->queueMutex); - - std::string data = this->internalQueue.front(); - if(this->queue->try_send(data.data(), data.size(), 0)) - { - this->internalQueue.pop(); - } - } - - std::this_thread::sleep_for(1000us); - } - } - void Channel::queueWorker() { while (!this->terminateQueue) diff --git a/src/Utils/IPC.hpp b/src/Utils/IPC.hpp index ade2cc85..c12728db 100644 --- a/src/Utils/IPC.hpp +++ b/src/Utils/IPC.hpp @@ -47,7 +47,6 @@ namespace Utils void enqueueMessage(std::string data); void queueWorker(); - void queueWorker2(); bool terminateQueue; std::condition_variable queueEvent;