Notbad
Notbad

Reputation: 6296

boost smart_ptr non thread safe macro, does it really exist?

I have seen in some stackoverflow questions/answers people talking about a boost macro (I guess it should be set at compile time) to avoid smart_ptr thread safeness. I have been searching for it around and wasn't able to find it. Could anybody point it out?

In the other hand, using this macro will avoid the ref counting heap allocation?.

Thanks in advance.

Upvotes: 0

Views: 276

Answers (1)

Sebastian Mach
Sebastian Mach

Reputation: 39099

http://www.boost.org/doc/libs/1_48_0/libs/smart_ptr/shared_ptr.htm#ThreadSafety

If your program is single-threaded and does not link to any libraries that might have used shared_ptr in its default configuration, you can #define the macro BOOST_SP_DISABLE_THREADS on a project-wide basis to switch to ordinary non-atomic reference count updates.

Upvotes: 3

Related Questions