simple example of how spinlocks can be used fast

This example shows how a spinlock can be used in a situation where performance is important.
The lock is only aquired if data needs to be modified, or was modified.