Synchronization means "waiting", and locks are the technology to realize "waiting". The meaning of threads is that it is best to only do one thing. If it must "wait" for other threads in the process of doing something, then " Waiting", skipping is meaningless. If you are afraid of "waiting" for a long time, you can use another daemon thread to regularly check the status of the worker thread.
Synchronization means "waiting", and locks are the technology to realize "waiting".
The meaning of threads is that it is best to only do one thing. If it must "wait" for other threads in the process of doing something, then " Waiting", skipping is meaningless.
If you are afraid of "waiting" for a long time, you can use another daemon thread to regularly check the status of the worker thread.