[IPC] Use first worker

This commit is contained in:
momo5502 2017-01-28 19:22:39 +01:00
parent f81f820b47
commit cd15ad88cd
2 changed files with 1 additions and 21 deletions

View File

@ -9,7 +9,7 @@ namespace Utils
if(this->remove) boost::interprocess::message_queue::remove(this->name.data()); 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))); 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() Channel::~Channel()
@ -113,25 +113,6 @@ namespace Utils
} }
} }
void Channel::queueWorker2()
{
while (!this->terminateQueue)
{
if(!this->internalQueue.empty())
{
std::lock_guard<std::mutex> 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() void Channel::queueWorker()
{ {
while (!this->terminateQueue) while (!this->terminateQueue)

View File

@ -47,7 +47,6 @@ namespace Utils
void enqueueMessage(std::string data); void enqueueMessage(std::string data);
void queueWorker(); void queueWorker();
void queueWorker2();
bool terminateQueue; bool terminateQueue;
std::condition_variable queueEvent; std::condition_variable queueEvent;