mirror of https://github.com/winsw/winsw
[Issue #124] - Prevent the CPU overutilization due to the usage of Milliseconds instead of TotalMsec
parent
929b87c383
commit
dfafc2790d
|
@ -440,12 +440,24 @@ namespace winsw
|
|||
private void WaitForProcessToExit(Process processoWait)
|
||||
{
|
||||
SignalShutdownPending();
|
||||
|
||||
int effectiveProcessWaitSleepTime;
|
||||
if (_descriptor.SleepTime.TotalMilliseconds > Int32.MaxValue)
|
||||
{
|
||||
Log.Warn("The requested sleep time " + _descriptor.SleepTime.TotalMilliseconds + "is greater that the max value " +
|
||||
Int32.MaxValue + ". The value will be truncated");
|
||||
effectiveProcessWaitSleepTime = Int32.MaxValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
effectiveProcessWaitSleepTime = (int)_descriptor.SleepTime.TotalMilliseconds;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// WriteEvent("WaitForProcessToExit [start]");
|
||||
|
||||
while (!processoWait.WaitForExit(_descriptor.SleepTime.Milliseconds))
|
||||
while (!processoWait.WaitForExit(effectiveProcessWaitSleepTime))
|
||||
{
|
||||
SignalShutdownPending();
|
||||
// WriteEvent("WaitForProcessToExit [repeat]");
|
||||
|
|
Loading…
Reference in New Issue