TIL about thread safety, and how to do it.