Home > Back-end >  Multithreaded regularly repeat create problems
Multithreaded regularly repeat create problems

Time:10-12

A program, for example, need to create five thread regularly work, work is to go to a different address to get the data,
WaitForMultipleObjects is then used to wait for their return, and then continue to the back of the job, but I found the program using some process management software to hang for a period of time, check the process thread, there will be a large number of threads, thread state is terminated, such repeated regularly create a thread to process their own good? Take up a large number of process memory?
I tried to not repeat creation, is a cycle, behind the thread hanging themselves and then the next time when the thread to restore, but this kind of method, WaitForMultipleObjects couldn't return, it has been in a wait state, do you have any Suggestions?

CodePudding user response:

WaitForMultipleObjects, WaitForSingleObject if the thread is waiting for object must wait until end of the thread to return
  • Related