Use #ifdef instead of #if defined.

This makes these tests a bit more consistent with the tests done at the
bottom of the file.
Add __sync_synchronize().

This function can easily be implemented on top of the mb() macro
provided by <machine/atomic.h>.