Race Conditions and How to Prevent Them