Improve spinlock implementation

and fix a small compiler warning.

Signed-off-by: Olivier Langlois <olivier@trillion01.com>