lmsg/SocketPool.hh

00001 /* -*- mode: c++; c-basic-offset: 4; -*- */
00002 #ifndef LMSG_SOCKETPOOL_HH
00003 #define LMSG_SOCKETPOOL_HH
00004 #include "gmutex.hh"
00005 #include <list>
00006 
00007 namespace lmsg {
00008     class Socket;
00009 
00017     class SocketPool {
00018     public:
00029         enum requestType {s_new, s_reusable};
00030     public:
00034         ~SocketPool(void);
00035 
00039         SocketPool(void);
00040 
00054         Socket* getSocket(requestType type, const MsgAddr* addr=0);
00055 
00060         void returnSocket(Socket* s);
00061     private:
00062         typedef std::list<Socket*> SocketList;
00063         typedef SocketList::iterator Pool_Iter;
00064         SocketList mClient;
00065         thread::mutex mMux;
00066     }; // SocketPool class
00067 
00068 } // namespace lmsg
00069 
00070 extern lmsg::SocketPool defaultLMsgSocketPool;
00071 
00072 #endif // LMSG_SOCKETPOOL_HH

Generated on Sun Mar 8 19:20:50 2009 for dmt by  doxygen 1.5.4