• Content count

  • Joined

  • Last visited

Community Reputation

119 Neutral

About juggler

  • Rank
  1. [quote name='mrbastard' timestamp='1343129554' post='4962566'] Worth noting that one of the potential performance issues with shared_ptr is that the ref count has to be allocated on the heap. Boost also provides intrusive_ptr - same as shared_ptr but the ref count is a static member of the pointed-to class. If you care, and don't mind changing your pointed-to classes, that is. [/quote] Not necessarily true for modern shared_ptr implementations. If you use make_shared to allocate your object the ref count will be merged with the object allocation. It also does some optimizations to reduce the memory usage of shared_ptr.
  2. thread issue in c++11

    The mutex must be shared between the threads, so move the mutex declaration out of the hello function and make it global instead. At the moment each thread has its own mutex, so locking it does nothing.