Attempt better support for memory barriers

Haven't had a chance to test some of these (they come from
documentation) so might still have a few issues.
Fix write barriers

Using only read barriers was incorrect. Now add the correct write
barriers and use them when necessary.
Fix barrier usage

* Accidentally used a write barrier when a read was needed.
* Placed all write barriers after the operation.
Fix example to always use uint64_t

For 32-bit builds the sum would wrap around and print a negative number.
This has been fixed.
Add additional thread to sporadic example

Two threads now spawn instead of one.