Added extra tests; tidied.
Minor modifications for testing.
Change spinlock to use gcc atomic function when available; enhanced spinlock tests.
Minor changes to tests; fix typo; tidy up.