Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
tlb
· 4y ago · 0 comments
std::shared_ptr doesn't use mutexes in any implementation I know of. They use atomic instructions for incrementing and decrementing the reference count, which are very fast.
Comments
[–]
intelVISA
4y ago
Plus their thread-safety is limited to the pointer's control block not the actual object it's pointing to.
e: nvm reading hard brain mutex too slow
[–]
another_another
4y ago
You're right, an atomic inc/dec would also do just fine. I stand corrected.