How do you ensure thread safety when multiple users are updating a shared global state simultaneously?