Avoid race conditions in SpinLock.

Use a ReentrantReadWriteLock to avoid a race condition in the SpinLock
class. Fixes issue #2.
Merge pull request #7 from pkwarren/issue_2

Avoid race conditions in SpinLock.