3 ms·
Yeah, I was talking about spinlocks. You're right that context switches would dominate std::mutex. For some reason I was thinking std::mutex uses spinlocks, ev
by vardump 11y ago
Yeah, I was talking about spinlocks.
You're right that context switches would dominate std::mutex. For some reason I was thinking std::mutex uses spinlocks, even though I knew better. Too much kernel side coding lately - context switches are often not possible there, so mutexes are often not possible as potential synchronization mechanisms.
- gpderetta 11y agoYou might still be right. The implementation of std::mutex is unspecified, and real world implementations will probably spin a bit before going into the kernel, so for your test case with a tiny critical section it might behave like a spinlock.