New SharedSingleton, resolves destruction of objects with static storage duration.

This commit is contained in:
Vinnie Falco
2013-09-12 04:35:13 -07:00
parent 41eb8a1e29
commit 55447b05ac
17 changed files with 150 additions and 229 deletions

View File

@@ -17,18 +17,14 @@
*/
//==============================================================================
class DeadlineTimer::Manager
: public SharedSingleton <DeadlineTimer::Manager>
, protected Thread
class DeadlineTimer::Manager : protected Thread
{
private:
typedef CriticalSection LockType;
typedef List <DeadlineTimer> Items;
public:
Manager ()
: SharedSingleton <Manager> (SingletonLifetime::persistAfterCreation)
, Thread ("DeadlineTimer::Manager")
Manager () : Thread ("DeadlineTimer::Manager")
{
startThread ();
}
@@ -200,11 +196,6 @@ public:
}
}
static Manager* createInstance ()
{
return new Manager;
}
private:
CriticalSection m_mutex;
Items m_items;
@@ -214,7 +205,8 @@ private:
DeadlineTimer::DeadlineTimer (Listener* listener)
: m_listener (listener)
, m_manager (Manager::getInstance ())
, m_manager (SharedSingleton <Manager>::getInstance (
SingletonLifetime::persistAfterCreation))
, m_isActive (false)
{
}