Core: Converted (hopefully) all remaining singletons to use ACE_Singleton class

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-12-22 20:52:47 +01:00
parent 7b4e1c6387
commit 0948fc5bbe
6 changed files with 28 additions and 57 deletions

View File

@@ -363,10 +363,3 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
return m_NetThreads[min].AddSocket (sock);
}
WorldSocketMgr*
WorldSocketMgr::Instance()
{
return ACE_Singleton<WorldSocketMgr,ACE_Thread_Mutex>::instance();
}

View File

@@ -37,42 +37,38 @@ class ACE_Event_Handler;
class WorldSocketMgr
{
public:
friend class WorldSocket;
friend class ACE_Singleton<WorldSocketMgr,ACE_Thread_Mutex>;
friend class WorldSocket;
friend class ACE_Singleton<WorldSocketMgr, ACE_Thread_Mutex>;
/// Start network, listen at address:port .
int StartNetwork (ACE_UINT16 port, const char* address);
/// Start network, listen at address:port .
int StartNetwork(ACE_UINT16 port, const char* address);
/// Stops all network threads, It will wait for all running threads .
void StopNetwork();
/// Stops all network threads, It will wait for all running threads .
void StopNetwork();
/// Wait untill all network threads have "joined" .
void Wait();
/// Make this class singleton .
static WorldSocketMgr* Instance();
/// Wait untill all network threads have "joined" .
void Wait();
private:
int OnSocketOpen(WorldSocket* sock);
int OnSocketOpen(WorldSocket* sock);
int StartReactiveIO(ACE_UINT16 port, const char* address);
int StartReactiveIO(ACE_UINT16 port, const char* address);
private:
WorldSocketMgr();
virtual ~WorldSocketMgr();
WorldSocketMgr();
virtual ~WorldSocketMgr();
ReactorRunnable* m_NetThreads;
size_t m_NetThreadsCount;
ReactorRunnable* m_NetThreads;
size_t m_NetThreadsCount;
int m_SockOutKBuff;
int m_SockOutUBuff;
bool m_UseNoDelay;
int m_SockOutKBuff;
int m_SockOutUBuff;
bool m_UseNoDelay;
ACE_Event_Handler* m_Acceptor;
ACE_Event_Handler* m_Acceptor;
};
#define sWorldSocketMgr WorldSocketMgr::Instance()
#define sWorldSocketMgr ACE_Singleton<WorldSocketMgr,ACE_Thread_Mutex>::instance()
#endif
/// @}