From 1b167ec5ad101ac44451381e26cc73ab5d67d2a1 Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期一, 26 四月 2021 16:37:52 +0800 Subject: [PATCH] fix socket busy loop; del locked readall; refactor. --- src/sendq.cpp | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/sendq.cpp b/src/sendq.cpp index 5b57d72..c0d5afd 100644 --- a/src/sendq.cpp +++ b/src/sendq.cpp @@ -16,10 +16,12 @@ * ===================================================================================== */ #include "sendq.h" -#include "shm_queue.h" +#include "shm_msg_queue.h" #include <chrono> -int SendQ::DoSend1Remote(bhome_shm::ShmMsgQueue &mq, const Remote remote, Array &arr) +using namespace bhome_shm; + +int SendQ::DoSend1Remote(ShmMsgQueue &mq, const Remote remote, Array &arr) { auto FirstNotExpired = [](Array &l) { auto Less = [](const TimedMsg &msg, const TimePoint &tp) { return msg.expire() < tp; }; @@ -65,7 +67,7 @@ return nprocessed; } -int SendQ::DoSend1Remote(bhome_shm::ShmMsgQueue &mq, const Remote remote, ArrayList &al) +int SendQ::DoSend1Remote(ShmMsgQueue &mq, const Remote remote, ArrayList &al) { int nsend = 0; auto AllSent = [&](Array &arr) { @@ -76,7 +78,7 @@ return nsend; } -bool SendQ::TrySend(bhome_shm::ShmMsgQueue &mq) +bool SendQ::TrySend(ShmMsgQueue &mq) { std::unique_lock<std::mutex> lock(mutex_out_); size_t nsend = 0; -- Gitblit v1.8.0