A, why want to thread synchronization
In a multithreaded program, there will be a multiple threads preempted a resource situation, this time is likely to cause conflict, which is hardly a thread may also will change the resource conservation, another thread began to change, may cause data inconsistencies, thus introducing a multithreaded synchronization, that is to say, multiple threads can only be a Shared resource for change, other threads can modify data,
Second, the method of thread synchronization