Implement atomicReadMVar, fixing #4001.