Re: ThreadPool проблема зависания
От: Pavel Dvorkin Россия  
Дата: 13.01.15 13:36
Оценка: +1
Здравствуйте, zoom-zoom, Вы писали:

Thread.Sleep есть обертка над Sleep от Win32, а поэтом читаем то, что здесь написано.

http://msdn.microsoft.com/ru-ru/library/windows/desktop/ms686298%28v=vs.85%29.aspx

В особенности это

If dwMilliseconds is less than the resolution of the system clock, the thread may sleep for less than the specified length of time. If dwMilliseconds is greater than one tick but less than two, the wait can be anywhere between one and two ticks, and so on. To increase the accuracy of the sleep interval, call the timeGetDevCaps function to determine the supported minimum timer resolution and the timeBeginPeriod function to set the timer resolution to its minimum. Use caution when calling timeBeginPeriod, as frequent calls can significantly affect the system clock, system power usage, and the scheduler. If you call timeBeginPeriod, call it one time early in the application and be sure to call the timeEndPeriod function at the very end of the application.


и это

Be careful when using Sleep in the following scenarios:
...
Threads that are under concurrency control. For example, an I/O completion port or thread pool limits the number of associated threads that can run. If the maximum number of threads is already running, no additional associated thread can run until a running thread finishes. If a thread uses Sleep with an interval of zero to wait for one of the additional associated threads to accomplish some work, the process might deadlock.
With best regards
Pavel Dvorkin
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.