History

resolve conflicts on merge with upstream master

Stephen Birarda committed 11 years ago

Commit edade7b2 parents 7b4522e 539063062 files · +1251 −255Browse files

Showing the changes to assignment-client/src/AssignmentClientMonitor.cpp (1 of 62 files). Show all

Unified · Split

assignment-client/src/AssignmentClientMonitor.cpp+24−2
@@ -70,6 +70,17 @@ AssignmentClientMonitor::~AssignmentClientMonitor() { · 69 unmodified lines
7070 stopChildProcesses();
7171 }
7272
73+void AssignmentClientMonitor::waitOnChildren(int msecs) {
74+ QMutableListIterator<QProcess*> i(_childProcesses);
75+ while (i.hasNext()) {
76+ QProcess* childProcess = i.next();
77+ bool finished = childProcess->waitForFinished(msecs);
78+ if (finished) {
79+ i.remove();
80+ }
81+ }
82+}
83+
7384 void AssignmentClientMonitor::stopChildProcesses() {
7485 auto nodeList = DependencyManager::get<NodeList>();
7586
@@ -79,11 +90,22 @@ void AssignmentClientMonitor::stopChildProcesses() { · 3 unmodified lines
7990 QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode);
8091 nodeList->writeUnverifiedDatagram(diePacket, *node->getActiveSocket());
8192 });
93+
94+ // try to give all the children time to shutdown
95+ waitOnChildren(15000);
96+}
97+
98+void AssignmentClientMonitor::aboutToQuit() {
99+ stopChildProcesses();
100+ // clear the log handler so that Qt doesn't call the destructor on LogHandler
101+ qInstallMessageHandler(0);
82102 }
83103
84104 void AssignmentClientMonitor::spawnChildClient() {
85105 QProcess *assignmentClient = new QProcess(this);
86106
107+ _childProcesses.append(assignmentClient);
108+
87109 // unparse the parts of the command-line that the child cares about
88110 QStringList _childArguments;
89111 if (_assignmentPool != "") {
@@ -120,8 +142,6 @@ void AssignmentClientMonitor::spawnChildClient() { · 30 unmodified lines
120142 qDebug() << "Spawned a child client with PID" << assignmentClient->pid();
121143 }
122144
123−
124−
125145 void AssignmentClientMonitor::checkSpares() {
126146 auto nodeList = DependencyManager::get<NodeList>();
127147 QUuid aSpareId = "";
@@ -157,6 +177,8 @@ void AssignmentClientMonitor::checkSpares() { · 29 unmodified lines
157177 nodeList->writeUnverifiedDatagram(diePacket, childNode);
158178 }
159179 }
180+
181+ waitOnChildren(0);
160182 }
161183
162184

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t