On 12/18/2017 6:02 PM, Tony Harminc wrote:
I wouldn't want to have to argue the case for having an enabled application program do spin loops. But we don't know the context this code was found in; maybe it's part of an OS or a standalone program.
In my entire IT career, most of which has been spent developing system software, I have never once had to resort to a home-grown spin lock. Long, long ago I authored a FIFO "lock manager" based on the examples found in the Principals of Operation. It has served us well for decades. The same logic works whether the pool of locks is local storage or global storage. As long as both asynchronous units of work have some way of waiting and being posted (and that might be SUSPEND/RESUME for preemptible class SRBs), then a spin lock should *never* be required.
-- Phoenix Software International Edward E. Jaffe 831 Parkview Drive North El Segundo, CA 90245 http://www.phoenixsoftware.com/