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
70 stopChildProcesses();70 stopChildProcesses();
71}71}
72 72
73void 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
73void AssignmentClientMonitor::stopChildProcesses() {84void AssignmentClientMonitor::stopChildProcesses() {
74 auto nodeList = DependencyManager::get<NodeList>();85 auto nodeList = DependencyManager::get<NodeList>();
75 86
@@ -79,11 +90,22 @@ void AssignmentClientMonitor::stopChildProcesses() { · 3 unmodified lines
79 QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode);90 QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode);
80 nodeList->writeUnverifiedDatagram(diePacket, *node->getActiveSocket());91 nodeList->writeUnverifiedDatagram(diePacket, *node->getActiveSocket());
81 });92 });
93
94 // try to give all the children time to shutdown
95 waitOnChildren(15000);
96}
97
98void AssignmentClientMonitor::aboutToQuit() {
99 stopChildProcesses();
100 // clear the log handler so that Qt doesn't call the destructor on LogHandler
101 qInstallMessageHandler(0);
82}102}
83 103
84void AssignmentClientMonitor::spawnChildClient() {104void AssignmentClientMonitor::spawnChildClient() {
85 QProcess *assignmentClient = new QProcess(this);105 QProcess *assignmentClient = new QProcess(this);
86 106
107 _childProcesses.append(assignmentClient);
108
87 // unparse the parts of the command-line that the child cares about109 // unparse the parts of the command-line that the child cares about
88 QStringList _childArguments;110 QStringList _childArguments;
89 if (_assignmentPool != "") {111 if (_assignmentPool != "") {
@@ -120,8 +142,6 @@ void AssignmentClientMonitor::spawnChildClient() { · 30 unmodified lines
120 qDebug() << "Spawned a child client with PID" << assignmentClient->pid();142 qDebug() << "Spawned a child client with PID" << assignmentClient->pid();
121}143}
122 144
123
124
125void AssignmentClientMonitor::checkSpares() {145void AssignmentClientMonitor::checkSpares() {
126 auto nodeList = DependencyManager::get<NodeList>();146 auto nodeList = DependencyManager::get<NodeList>();
127 QUuid aSpareId = "";147 QUuid aSpareId = "";
@@ -157,6 +177,8 @@ void AssignmentClientMonitor::checkSpares() { · 29 unmodified lines
157 nodeList->writeUnverifiedDatagram(diePacket, childNode);177 nodeList->writeUnverifiedDatagram(diePacket, childNode);
158 }178 }
159 }179 }
180
181 waitOnChildren(0);
160}182}
161 183
162 184

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