Working Mac OS X build.
Note that there is still some missing functionality for a clean lib (shutdown + memory barriers), but this currently works.
Small change for slightly more frequent samples.