diff options
author | Brad King <brad.king@kitware.com> | 2005-06-17 18:05:35 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2005-06-17 18:05:35 (GMT) |
commit | 5df6d35dc6992c2deb65a034f02b6f02c3f6b673 (patch) | |
tree | 642b1484ddc2a84d5dd56b6a5351819df0acc829 /Source/kwsys/ProcessWin32.c | |
parent | 28ffc134a097c77f3548cd236f2d00f0b5686c36 (diff) | |
download | CMake-5df6d35dc6992c2deb65a034f02b6f02c3f6b673.zip CMake-5df6d35dc6992c2deb65a034f02b6f02c3f6b673.tar.gz CMake-5df6d35dc6992c2deb65a034f02b6f02c3f6b673.tar.bz2 |
BUG: Fixed polling feature of WaitForData.
Diffstat (limited to 'Source/kwsys/ProcessWin32.c')
-rw-r--r-- | Source/kwsys/ProcessWin32.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c index bf29dd2..8547782 100644 --- a/Source/kwsys/ProcessWin32.c +++ b/Source/kwsys/ProcessWin32.c @@ -101,6 +101,7 @@ static void kwsysProcessCleanErrorMessage(kwsysProcess* cp); static int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout, kwsysProcessTime* timeoutTime); static int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime, + double* userTimeout, kwsysProcessTime* timeoutLength); static kwsysProcessTime kwsysProcessTimeGetCurrent(); static DWORD kwsysProcessTimeToDWORD(kwsysProcessTime t); @@ -1300,7 +1301,8 @@ int kwsysProcess_WaitForData(kwsysProcess* cp, char** data, int* length, } /* Setup a timeout if required. */ - if(kwsysProcessGetTimeoutLeft(&timeoutTime, &timeoutLength)) + if(kwsysProcessGetTimeoutLeft(&timeoutTime, user?userTimeout:0, + &timeoutLength)) { /* Timeout has already expired. */ expired = 1; @@ -2122,7 +2124,8 @@ int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout, kwsysProcessTime userTimeoutLength = kwsysProcessTimeFromDouble(*userTimeout); kwsysProcessTime userTimeoutTime = kwsysProcessTimeAdd(currentTime, userTimeoutLength); - if(kwsysProcessTimeLess(userTimeoutTime, *timeoutTime)) + if(timeoutTime->QuadPart < 0 || + kwsysProcessTimeLess(userTimeoutTime, *timeoutTime)) { *timeoutTime = userTimeoutTime; return 1; @@ -2135,6 +2138,7 @@ int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout, /* Get the length of time before the given timeout time arrives. Returns 1 if the time has already arrived, and 0 otherwise. */ int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime, + double* userTimeout, kwsysProcessTime* timeoutLength) { if(timeoutTime->QuadPart < 0) @@ -2147,6 +2151,13 @@ int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime, /* Calculate the remaining time. */ kwsysProcessTime currentTime = kwsysProcessTimeGetCurrent(); *timeoutLength = kwsysProcessTimeSubtract(*timeoutTime, currentTime); + + if(timeoutLength->QuadPart < 0 && userTimeout && *userTimeout <= 0) + { + /* Caller has explicitly requested a zero timeout. */ + timeoutLength->QuadPart = 0; + } + if(timeoutLength->QuadPart < 0) { /* Timeout has already expired. */ |