Mercurial > hg > piper-cpp
diff vamp-client/ProcessQtTransport.h @ 125:ea06fae1567c
Rename server to simple-server, and add some more description in usage
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 28 Oct 2016 11:08:17 +0100 |
parents | 4ff643c1eccc |
children | 2004ec2b653e |
line wrap: on
line diff
--- a/vamp-client/ProcessQtTransport.h Thu Oct 27 16:14:22 2016 +0100 +++ b/vamp-client/ProcessQtTransport.h Fri Oct 28 11:08:17 2016 +0100 @@ -54,8 +54,11 @@ * using Qt's QProcess abstraction and talks to it via stdin/stdout * channels. Calls are completely serialized; the protocol only * supports one call in process at a time, and therefore the transport - * only allows one at a time. This class is thread-safe because it - * serializes explicitly using a mutex. + * only allows one at a time. + * + * This class is thread-safe, but in practice you can only use it from + * within a single thread, because the underlying QProcess does not + * support switching threads. */ class ProcessQtTransport : public SynchronousTransport { @@ -129,6 +132,7 @@ std::cerr << "writing " << size << " bytes to server" << std::endl; #endif m_process->write(ptr, size); + m_process->waitForBytesWritten(1000); std::vector<char> buffer; bool complete = false; @@ -142,6 +146,7 @@ std::cerr << "waiting for data from server..." << std::endl; #endif m_process->waitForReadyRead(1000); + if (m_process->state() == QProcess::NotRunning) { QProcess::ProcessError err = m_process->error(); if (err == QProcess::Crashed) {