Boost logo

Boost :

From: Andrey Semashev (andysem_at_[hidden])
Date: 2007-02-05 15:11:40


Hello Fabien,

Monday, February 5, 2007, 10:47:37 PM, you wrote:

> Probably you should put it has a static local variable inside a protected
> function, like this:

> //! The method returns a reference to the only dispatcher instance

> static state_dispatcher const& get()
> {
> static state_dispatcher instance;
> return instance;
> }

> The only problem here is I'm not sure how the compilers reacted when
> instanciating static variable inside template functions...

That's exactly what it was before. The problem is that it's not
thread-safe.

-- 
Best regards,
 Andrey                            mailto:andysem_at_[hidden]

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk