4 ms·
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.
by jey 15y ago
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.
- mentat 15y agoI'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).