Hacker News new | past | comments | ask | show | jobs | submit login

I agree. It looks like their read implementation means that every thread pops the same item off as well, since they clone to a temp variable.



Threads have separate stacks and the call to front() and pop_front() is protected by the mutex, so that part is fine as far as I can see.


I'm not familiar with the STL implementation, but it seems the pop would need to be coherent with the push in an empty stack. Like if a thread was trying to pop the only entry while another was trying to push, 'intuitively' there'd be a race condition there if STL isn't thread safe (which is the whole point of the article I think).




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

Search: