[vlc-devel] commit: Adding a generic singleton pattern implementation ( Hugo Beauzee-Luyssen )

Jean-Baptiste Kempf jb at videolan.org
Fri Dec 25 18:44:09 CET 2009


On Fri, Dec 25, 2009 at 06:39:25PM +0100, Ruud Althuizen wrote :
> On Fri 25 Dec 2009 06:19 PM, git version control wrote:
> > +    static T*      getInstance( intf_thread_t *p_intf = NULL )
> > +    {
> > +        if ( m_instance == NULL )
> > +            m_instance = new T( p_intf );
> > +        return m_instance;
> > +    }
> Please note that this is not threading safe. It probably doesn't matter in
> the VLC cases that it's used, but has caused a lot of problems in a school
> project of mine.
That was also the case before. But sure, Qt interface is not
thread-safe.

Best Regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/



More information about the vlc-devel mailing list