Are smart pointers threadsafe?

uj
Total Points:
1,350
Status Points:
0
Brown Belt
May 5, 2008 1:53 AM PDT
Rate
 
#2 Reply to #1

Raf_Schietekat:

The reference says shared_ptr offers the same thread-safety as built-in types. I've interpreted this as they're like integers for example which need to be updated in atomic operations if they're shared among threads and simultaneously read and written. This is why TBB offers atomic<T> isn't it?

Well, I may be wrong but I don't think shared_ptr is "atomic". Could someone please shed some light on this.

 



Intel Software Network Forums Statistics

8290 users have contributed to 31236 threads and 99111 posts to date.
In the past 24 hours, we have 7 new thread(s) 19 new posts(s), and 24 new user(s).

In the past 3 days, the most popular thread for everyone has been comparison cilk++, openmp, pthreads first results The most posts were made to comparison cilk++, openmp, pthreads first results The post with the most views is Very amusing...  Escalated as

Please welcome our newest member zq.x