3 ms·
Lock doesn't have to sleep. The semantic of a lock is that on acquisition it blocks until it's available, and upon unblocking the caller thread has acquired th
by ww520 5y ago
Lock doesn't have to sleep. The semantic of a lock is that on acquisition it blocks until it's available, and upon unblocking the caller thread has acquired the lock. The blocking can be sleep or be doing busy-spin.
Futex is the lower level mechanism to build higher level locks like mutex/semphore/conditional-variable/etc.