On 24 Jun 2010, at 09:27, Michael Schnell wrote:
[ARMv5 and lower atomic exchange]
If there is no other way with this arch but an
active spinning lock,
There is indeed none.
the blocked thread should at least give up it's
current time slice before retrying to get the lock, so that the
blocking
thread can work and release the lock. otherwise (in a single CPU
system)
the resting part of the time slice is deterministically wasted.
And on a multiple cpu system you can introduce extra latency if you
give up your time slice early. The compromise is obviously to try for
a few times and if it doesn't work after that, give up the time slice.
However, at this time the interlocked* routines are completely OS-
agnostic and that would require moving these routines to OS-specific
include files (or add the ability for OS-specific include files of the
system unit to override the implementation of these routines).
AFAIK calling "sleep(0)" would give up the time slice.
It doesn't on all systems.
Jonas
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel