- Timestamp:
- Jul 25, 2011, 2:36:02 PM (14 years ago)
- Location:
- trunk/src/corelib/io
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/corelib/io/qprocess.cpp
r902 r911 971 971 qDebug("QProcessPrivate::canWrite(), not writing anything (empty write buffer)."); 972 972 #endif 973 #if defined Q_OS_OS2 974 if (stdinChannel.pipe.closePending) 975 tryCloseStdinPipe(); 976 #endif 973 977 return false; 974 978 } … … 1122 1126 flushPipeWriter(); 1123 1127 #endif 1128 #ifdef Q_OS_OS2 1129 // postpone the real close until the other end reads all from the pipe buf 1130 stdinChannel.pipe.closePending = true; 1131 tryCloseStdinPipe(); 1132 #else 1124 1133 destroyPipe(stdinChannel.pipe); 1134 #endif 1125 1135 } 1126 1136 -
trunk/src/corelib/io/qprocess_os2.cpp
r902 r911 553 553 pipe.server = HPIPE(~0); 554 554 pipe.client = HFILE(~0); 555 pipe.closePending = false; 555 556 556 557 // we need the process identifier to guarantee pipe name unicity … … 612 613 void QProcessPrivate::destroyPipe(Channel::Pipe &pipe) 613 614 { 615 pipe.closePending = false; 616 614 617 if (pipe.client != ~HFILE(~0)) { 615 618 DosClose(pipe.client); … … 634 637 channel.pipe.server = HPIPE(~0); 635 638 channel.pipe.client = HFILE(~0); 639 channel.pipe.closePending = false; 636 640 637 641 if (&channel == &stderrChannel && processChannelMode == QProcess::MergedChannels) { … … 1342 1346 } 1343 1347 1348 void QProcessPrivate::tryCloseStdinPipe() 1349 { 1350 Q_ASSERT(stdinChannel.pipe.closePending); 1351 1352 if (stdinChannel.pipe.closePending) { 1353 // grab new bytes from QProcessManager (if any) 1354 int newBytes = pipeData[InPipe].newBytes.fetchAndStoreRelaxed(0); 1355 if (newBytes) 1356 pipeData[InPipe].bytesLeft = newBytes; 1357 if (pipeData[InPipe].bytesLeft == PIPE_SIZE_STDIN) { 1358 // the other end has read everything from the pipe buf so that it's 1359 // safe to close it now (satisfy the closeWriteChannel() request) 1360 destroyPipe(stdinChannel.pipe); 1361 } 1362 } 1363 } 1364 1344 1365 qint64 QProcessPrivate::writeToStdin(const char *data, qint64 maxlen) 1345 1366 { -
trunk/src/corelib/io/qprocess_p.h
r846 r911 118 118 pipe.server = HPIPE(~0); 119 119 pipe.client = HFILE(~0); 120 pipe.closePending = false; 120 121 #else 121 122 pipe[0] = INVALID_Q_PIPE; … … 155 156 HPIPE server; 156 157 HFILE client; 158 bool closePending; 157 159 }; 158 160 Pipe pipe; … … 243 245 void uninit(); 244 246 void ensureWaitSem(); 247 void tryCloseStdinPipe(); 245 248 #endif 246 249
Note:
See TracChangeset
for help on using the changeset viewer.