Ticket #199: qprocess_os2.diff

File qprocess_os2.diff, 1.6 KB (added by rudi, 13 years ago)

Attempt to fix blocking on DosRead?

  • qprocess_os2.cpp

     
    13221322
    13231323qint64 QProcessPrivate::readFromStdout(char *data, qint64 maxlen)
    13241324{
     1325    QMutexLocker lock(QProcessManager::pipeStateLock());
     1326
    13251327    ULONG actual = 0;
    13261328    APIRET arc = DosRead(stdoutChannel.pipe.server, data, maxlen, &actual);
    13271329
    13281330    qint64 bytesRead = -1;
    13291331    if (arc == NO_ERROR) {
    13301332        bytesRead = (qint64)actual;
     1333
     1334        if (!dying && pipeData[OutPipe].signaled) {
     1335            if (actual >= pipeData[OutPipe].bytes) {
     1336                pipeData[OutPipe].bytes = 0;
     1337                pipeData[OutPipe].signaled = false;
     1338            } else {
     1339                pipeData[OutPipe].bytes -= actual;
     1340            }
     1341        }
    13311342    }
    13321343
    13331344    DEBUG(("QProcessPrivate::readFromStdout(%p \"%s\", %lld) == %lld",
     
    13371348
    13381349qint64 QProcessPrivate::readFromStderr(char *data, qint64 maxlen)
    13391350{
     1351    QMutexLocker lock(QProcessManager::pipeStateLock());
     1352
    13401353    ULONG actual = 0;
    13411354    APIRET arc = DosRead(stderrChannel.pipe.server, data, maxlen, &actual);
    13421355
    13431356    qint64 bytesRead = -1;
    13441357    if (arc == NO_ERROR) {
    13451358        bytesRead = (qint64)actual;
     1359
     1360        if (!dying && pipeData[ErrPipe].signaled) {
     1361            if (actual >= pipeData[ErrPipe].bytes) {
     1362                pipeData[ErrPipe].bytes = 0;
     1363                pipeData[ErrPipe].signaled = false;
     1364            } else {
     1365                pipeData[ErrPipe].bytes -= actual;
     1366            }
     1367        }
    13461368    }
    13471369
    13481370    DEBUG(("QProcessPrivate::readFromStderr(%p \"%s\", %lld) == %lld",