The rule for using multi-thread to replace the function call inside the single thread.
1) Performance: When the execution time of function call is more than 0.1 second, the efficiency of CPU will be lowered too much, so we need to create a child thread to replace the function call.
2) Logic: When the logic of the code is asynchronous call instead of synchronous call or it is long time running task, the multithreaded is preferable.
1) Performance: When the execution time of function call is more than 0.1 second, the efficiency of CPU will be lowered too much, so we need to create a child thread to replace the function call.
2) Logic: When the logic of the code is asynchronous call instead of synchronous call or it is long time running task, the multithreaded is preferable.