Commit ae24f549 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

qt4: singleton: Use vlc_mutex_locker instead of manual lock/unlock

parent 40388189
...@@ -34,22 +34,20 @@ class Singleton ...@@ -34,22 +34,20 @@ class Singleton
public: public:
static T* getInstance( intf_thread_t *p_intf = NULL ) static T* getInstance( intf_thread_t *p_intf = NULL )
{ {
vlc_mutex_lock( &m_mutex ); vlc_mutex_locker lock( &m_mutex );
if ( m_instance == NULL ) if ( m_instance == NULL )
m_instance = new T( p_intf ); m_instance = new T( p_intf );
vlc_mutex_unlock( &m_mutex );
return m_instance; return m_instance;
} }
static void killInstance() static void killInstance()
{ {
vlc_mutex_lock( &m_mutex ); vlc_mutex_locker lock( &m_mutex );
if ( m_instance != NULL ) if ( m_instance != NULL )
{ {
delete m_instance; delete m_instance;
m_instance = NULL; m_instance = NULL;
} }
vlc_mutex_unlock( &m_mutex );
} }
protected: protected:
Singleton(){} Singleton(){}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment