rewrite SpinLock to still work without the need to accidentally disable optimizations for a large part of the classes unit

git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@27864 3ad0048d-3df7-0310-abae-a5850022a9f2