Attempt at memory sync function to overcome memory ordering challenges