d3fault said: > Unable to confirm the race condition, which is why I'm posting here > instead of filing the bug report. Isn't there a race condition between > calling QProcess::start() and QProcess::waitForFinished()? > > Can't the OS switch contexts at ANY TIME (in this case, between the > start() and waitForFinished() calls)? > > Scenario: > > QProcess proc; > proc.start("aVerySmallBinary"); > //OS switches contexts by sheer chance right here to the newly started > process. If the process is short enough it could finish and exit > cleanly before executing the following line > bool finished = proc.waitForFinished(); > //finished should be true, but in the race condition case it will be > false because waitForFinished "returns false ... if this QProcess is > already finished" (doc).
That shouldn't be a race condition, because you didn't yield to the event loop between start() and waitForFinished(), so any events relating to the termination of the process have not been processed yet. If you were to stick a processEvents() between start() and waitForFinished(), then you'd have a race condition. Note the docs say " ... if this QProcess is already finished", which is a different thing from whether the underlying native process is already finished :) _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development