But yes, a yield primitive would be nice, and so would knowing the number of CPUs.
I'm planning on submitting a patch shortly that determines the number of CPUs in the machine and adjusts the spinlock behavior accordingly (there are various APIs for getting the # of CPUs, like sysctl() on many Unixen and GetSystemInfo() on Win32).
Speaking of improving spinlock behavior, there's a Solaris API that I think might be worth using: schedctl_start() asks the scheduler to not pre-empt the current process, and schedctl_stop() cancels the request. The idea the first extremely short periods of time that we're holding a spinlock, we don't want to get preempted, since if the process was allowed to run for just a little bit longer it would probably give up the spinlock. The docs are here:
http://docs.sun.com/db/doc/816-3324/6m9k4vdu1?a=view
-Neil
---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster