What is thread-safe
Thread-safe multithreaded access the same code does not produce indeterminate results.
How to ensure the security thread
Code for non-safety lock control;
Use thread-safe class;
Multi-threaded concurrency, threads share the variables to the method-level local variables.