Keep threads from interfering with each other.