Revert "Remove unnecessary memory barrier"

This reverts commit b3ad8179990045010e46ca268f069c8c77bcee6f.