Neil Conway <[EMAIL PROTECTED]> writes: > Granted, but I think you've mostly conceded my point: every _subsequent_ > time TAS() is invoked, the non-locking test is a clear win (with the > possible exception of PPC).
I'm not real sure. One point here is that the standard advice about this stuff is generally thinking in terms of an *extremely* tight spin loop, ie while (TAS(lock)) ; The loop in s_lock.c has a bit more overhead than that. Also, because we only use spinlocks to protect LWLocks, the expected hold time for a spinlock is just a couple dozen instructions, which is probably less than the expected time in most other uses of spinlocks. So I think it's less than clear that we should expect TAS to fail, even within the loop. Basically I'd like to see some tests proving that there's actually any value in it before we go complicating the assembly-code API ... regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])