Are smart pointers threadsafe?

Raf Schietekat
Total Points:
16,585
Status Points:
16,585
Black Belt
May 7, 2008 2:27 AM PDT
Rate
 
#6 Reply to #5
Architecture-specific reference count management underneath shared_ptr is in boost/detail/sp_counted_base*.hpp. Note that it uses gcc where TBB confusingly uses linux (in tbb/machine). From a quick glance at gcc_x86 it seems decent enough?

(Added) A mutex is used in boost if there is no architecture-specific support for atomic access to a variable, at the cost of increasing its size and lowering its performance. TBB atomics are the size of the underlying type and always require a minimal set of supported architecture-specific operations, so it will not (be able to) fall back to using mutexes.



Intel Software Network Forums Statistics

8293 users have contributed to 31241 threads and 99118 posts to date.
In the past 24 hours, we have 12 new thread(s) 11 new posts(s), and 21 new user(s).

In the past 3 days, the most popular thread for everyone has been huge pages on linux? The most posts were made to Pipeline buffer between stages? The post with the most views is Another example attached (Tr

Please welcome our newest member bwillems