Are smart pointers threadsafe?

Raf Schietekat
Total Points:
16,805
Status Points:
16,805
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

8458 users have contributed to 31571 threads and 100533 posts to date.
In the past 24 hours, we have 17 new thread(s) 131 new posts(s), and 152 new user(s).

In the past 3 days, the most popular thread for everyone has been gemm(A,A,A) like possible? The most posts were made to gemm(A,A,A) like possible? The post with the most views is Quoting - rase if (k.eq.0

Please welcome our newest member soundmyth