2 ms·
For reference, golang's mutex also spins by up to 4 times before parking the goroutine on a semaphore. A lot less than the 40 times in the webkit blogpost, but
by arghwhat 9mo ago
For reference, golang's mutex also spins by up to 4 times before parking the goroutine on a semaphore. A lot less than the 40 times in the webkit blogpost, but I would definitely consider spinning an appropriate amount before sleeping to be common practice for a generic lock. Granted, as they have a userspace scheduler things do differ a bit there, but most concepts still apply.
https://github.com/golang/go/blob/2bd7f15dd7423b6817939b199cd2c8032e3b79cc/src/runtime/proc.go#L7938 https://github.com/golang/go/blob/2bd7f15dd7423b6817939b199c...
https://github.com/golang/go/blob/2bd7f15dd7423b6817939b199cd2c8032e3b79cc/src/internal/sync/mutex.go#L95 https://github.com/golang/go/blob/2bd7f15dd7423b6817939b199c...