Y
Hacker News
new
|
ask
|
show
|
jobs
by
tlb
1388 days ago
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.
2 comments
intelVISA
1388 days 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
link
another_another
1387 days ago
You're right, an atomic inc/dec would also do just fine. I stand corrected.
link
e: nvm reading hard brain mutex too slow