OS X pthread compatibility

Apple's Mac OS X does not implement
pthread barriers or spinlocks, so
here is some code to keep us running
on Macs.
remove unused variables

pointed out by Clang