A piece of code is thread-safe if it only manipulates data structures in a way that allows consistent execution of this code by multiple threads.
Thread safety is a computer programming concept applicable in the context of multi-threaded programs. A piece of code is thread-safe if it only manipulates shared data structures in a manner that guarantees safe execution by multiple threads at the same time. There are various strategies for making thread-safe data structures.