Fixing atomics (threading)

* atomic_inc and atomic_dec return now the value after the increment/decrement
* ReadWriteBarrier() is a compiler fence only, got replaced by a hardware fence (I assume this is what sync_barrier is supposed to be)