Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How does std::string copy on write cause race conditions?


Because if you "copy" a string and the copy really is just a reference to some shared data structure, changing the shared data structure later in another thread without memory barriers or other synchronization causes undefined behavior. Remember that the shared data structure will need a reference count to be updated whenever a reference gets deleted.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: