Add Mingw support, as _ReadWriteBarrier is a MSVC intrinsic.
Put the forward declaration of _ReadWriteBarrier before the intrinsic pragma to avoid errors in some MSVC versions