SpinLock improvements
Summary:
This makes several improvements to the SpinLock code:
- Add a SpinLock implementation using pthread_spinlock_t. On non-x86_64
platforms this is preferred over the pthread_mutex_t implementation
when available.
- For the pthread implementations, throw std::system_error on error,
rather than completely aborting the program using glog's CHECK()
macros.
- Update the pthread_mutex_t implementation to call
pthread_mutex_destroy() on destruction.
- Always unit test all implementations that can be compiled on the
current build platform, even though only a single implementation will
be selected as folly::SpinLock. This way x86_64 builds will still
unit test the pthread-based implementations.
Test Plan: Ran the unit tests.
Reviewed By: seanc@fb.com
Subscribers: trunkagent, doug, net-systems@, exa, folly-diffs@
FB internal diff:
D1735770
Signature: t1:
1735770:
1418445953:
b238aa8fb835a8d55e6e98e20c4615ae1938b98f