Create I/O service object in sender thread.

This commit is contained in:
lotodore
2009-01-26 20:57:39 +00:00
parent 7d1021cde7
commit e0ff6db98e
6 changed files with 27 additions and 11 deletions
+6 -2
View File
@@ -35,7 +35,7 @@ class SessionData;
class SenderThread : public Thread, public SenderInterface
{
public:
SenderThread(SenderCallback &cb, boost::asio::io_service& ioService);
SenderThread(SenderCallback &cb);
virtual ~SenderThread();
virtual void Start();
@@ -45,6 +45,8 @@ public:
virtual void Send(boost::shared_ptr<SessionData> session, boost::shared_ptr<NetPacket> packet);
virtual void Send(boost::shared_ptr<SessionData> session, const NetPacketList &packetList);
boost::shared_ptr<boost::asio::io_service> GetIOService();
protected:
typedef std::list<boost::shared_ptr<NetPacket> > SendDataList;
@@ -101,7 +103,9 @@ private:
mutable boost::mutex m_sendQueueMapMutex;
SenderCallback &m_callback;
boost::asio::io_service &m_ioService;
boost::shared_ptr<boost::asio::io_service> m_ioService;
mutable boost::shared_ptr<boost::barrier> m_ioServiceBarrier;
};
#endif