File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,10 +33,10 @@ class IOThreadTcpService : public ITcpService,
3333 return std::make_shared<make_shared_enabler>();
3434 }
3535
36- void startWorkerThread (size_t threadNum,
37- FrameCallback callback = nullptr )
36+ std::vector<brynet::net::EventLoop::Ptr> startWorkerThread (size_t threadNum,
37+ FrameCallback callback = nullptr )
3838 {
39- detail::TcpServiceDetail::startWorkerThread (threadNum, callback);
39+ return detail::TcpServiceDetail::startWorkerThread (threadNum, callback);
4040 }
4141
4242 void stopWorkerThread ()
Original file line number Diff line number Diff line change @@ -66,15 +66,17 @@ class TcpServiceDetail : public brynet::base::NonCopyable
6666 stopWorkerThread ();
6767 }
6868
69- void startWorkerThread (size_t threadNum,
70- FrameCallback callback = nullptr )
69+ std::vector<brynet::net::EventLoop::Ptr> startWorkerThread (size_t threadNum,
70+ FrameCallback callback = nullptr )
7171 {
72+ std::vector<brynet::net::EventLoop::Ptr> eventLoops;
73+
7274 std::lock_guard<std::mutex> lck (mServiceGuard );
7375 std::lock_guard<std::mutex> lock (mIOLoopGuard );
7476
7577 if (!mIOLoopDatas .empty ())
7678 {
77- return ;
79+ return eventLoops ;
7880 }
7981
8082 mRunIOLoop = std::make_shared<bool >(true );
@@ -84,6 +86,8 @@ class TcpServiceDetail : public brynet::base::NonCopyable
8486 for (auto & v : mIOLoopDatas )
8587 {
8688 auto eventLoop = std::make_shared<EventLoop>();
89+ eventLoops.push_back (eventLoop);
90+
8791 auto runIoLoop = mRunIOLoop ;
8892 wg->add (1 );
8993 v = IOLoopData::Create (eventLoop,
@@ -103,6 +107,8 @@ class TcpServiceDetail : public brynet::base::NonCopyable
103107 }));
104108 }
105109 wg->wait ();
110+
111+ return eventLoops;
106112 }
107113
108114 void stopWorkerThread ()
You can’t perform that action at this time.
0 commit comments