aboutsummaryrefslogtreecommitdiff
path: root/src/trinityrealm/RealmList.h
diff options
context:
space:
mode:
authorSpp <none@none>2010-05-02 00:06:08 +0200
committerSpp <none@none>2010-05-02 00:06:08 +0200
commit274457a7fb5a88ca43a07086ec52b06de19ef514 (patch)
treeed85bc25c7342dd87d828fbf7859cbba17be2b7b /src/trinityrealm/RealmList.h
parenta0e1357e2b35544e636443cedc3ae2d933df1454 (diff)
Make RealmList a Singleton.
Patch by Anubiss --HG-- branch : trunk
Diffstat (limited to 'src/trinityrealm/RealmList.h')
-rw-r--r--src/trinityrealm/RealmList.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/trinityrealm/RealmList.h b/src/trinityrealm/RealmList.h
index be0ff0c2351..b29b561c797 100644
--- a/src/trinityrealm/RealmList.h
+++ b/src/trinityrealm/RealmList.h
@@ -25,6 +25,8 @@
#ifndef _REALMLIST_H
#define _REALMLIST_H
+#include <ace/Singleton.h>
+#include <ace/Null_Mutex.h>
#include "Common.h"
/// Storage object for a realm
@@ -45,6 +47,9 @@ struct Realm
class RealmList
{
public:
+ // Null_Mutex is safe because the singleton initialized before the acceptor initialized(another place where the singleton called)
+ static RealmList* instance() { return ACE_Singleton<RealmList, ACE_Null_Mutex>::instance(); }
+
typedef std::map<std::string, Realm> RealmMap;
RealmList();
@@ -67,5 +72,8 @@ class RealmList
uint32 m_UpdateInterval;
time_t m_NextUpdateTime;
};
+
+#define sRealmList RealmList::instance()
+
#endif
/// @}