From 7ecd6323ffedbfef92c87c02b2a8680dd53b772c Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期四, 06 五月 2021 19:37:50 +0800 Subject: [PATCH] rename atomic queue io function. --- src/socket.h | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/socket.h b/src/socket.h index a5dd72c..08a4b0a 100644 --- a/src/socket.h +++ b/src/socket.h @@ -42,6 +42,7 @@ public: typedef ShmMsgQueue::MQId MQId; typedef bhome_shm::SharedMemory Shm; + typedef std::function<void(ShmSocket &sock, MsgI &imsg)> RawRecvCB; typedef std::function<void(ShmSocket &sock, MsgI &imsg, BHMsgHead &head)> RecvCB; typedef std::function<bool(ShmSocket &sock, MsgI &imsg, BHMsgHead &head)> PartialRecvCB; typedef std::function<void(ShmSocket &sock)> IdleCB; @@ -53,6 +54,7 @@ bool Remove() { return Remove(shm(), id()); } MQId id() const { return mq().Id(); } // start recv. + bool Start(const RawRecvCB &onData, const IdleCB &onIdle, int nworker = 1); bool Start(int nworker = 1, const RecvCB &onData = RecvCB(), const IdleCB &onIdle = IdleCB()); bool Start(const RecvCB &onData, const IdleCB &onIdle, int nworker = 1) { return Start(nworker, onData, onIdle); } bool Start(const RecvCB &onData, int nworker = 1) { return Start(nworker, onData); } @@ -112,7 +114,7 @@ std::unique_lock<std::mutex> lk(st->mutex); bool sendok = Send(remote, head, body, std::move(OnRecv)); if (!sendok) { - printf("send timeout\n"); + LOG_DEBUG() << "send timeout"; } if (sendok && st->cv.wait_until(lk, endtime) == std::cv_status::no_timeout) { return true; -- Gitblit v1.8.0