Click here to Skip to main content
15,880,796 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
so,if occured that,program can running still,but now,how many thread alive?
if has two cpu,generated four threads,now,three?
Posted
Comments
Sergey Alexandrovich Kryukov 10-Jun-14 0:58am    
Not clear at all. You application can have many threads, the question is why...
The question does not make any apparent sense.
—SA
yzqxmu_seventeen 10-Jun-14 2:00am    
en,sorry,sorry,i means iocp often need a thread pool for work thread,according to the many articles, the number of thread in thread pool best two times the number of CPU.OK,if double cpu,the number of thread is four.now,occured error,one thread exit,next error,one thread exit,next....server crash?On the another hand,just one error?Thread pool efficiency???
Sergey Alexandrovich Kryukov 10-Jun-14 9:30am    
You don't have to use thread pool. What "server crash"? What "server"? This is irrelevant. I never tried to deplete the pool, but it you create a thread yourself, you can create many. You won't improve performance having more threads then total cores. Threads have been created for logically parallel operation, not throughput. If you have logically independent activities represented by many threads (say, tens, many), you can have them, if not — it makes no sense. That's why I asked about why would you need them.
—SA

1 solution

If you have a pool of threads and one thread exits - that's likely a design flaw. The work performed by the thread should not cause the thread exit. Normally it does some work and returns to the pool to wait for more work.

If GetQueuedCompletionStatus returns an error - write code to handle the error and allow the thread to return to an idle state waiting for more work.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900