Skip to content

Commit 5c1f880

Browse files
Dan RileyDan Riley
authored andcommitted
fix vector handling and spurious wakeups
1 parent e04f43e commit 5c1f880

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

FWCore/Modules/src/TimeStudyModules.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,13 @@ namespace timestudy {
232232
return true;
233233
}
234234
//every running stream is now waiting
235-
return waitingStreams_.size() == activeStreams_;
235+
return waitingStreams_.size() > 0 and waitingStreams_.size() == activeStreams_;
236236
}
237237

238238
void threadWork() {
239239
while (not stopProcessing_.load()) {
240240
std::vector<int> streamsToProcess;
241+
streamsToProcess.reserve(waitingStreams_.capacity());
241242
{
242243
std::unique_lock<std::mutex> lk(mutex_);
243244
condition_.wait(lk, [this]() { return readyToDoSomething(); });
@@ -266,6 +267,7 @@ namespace timestudy {
266267
}
267268
}
268269
waitingTaskPerStream_.clear();
270+
waitingTaskPerStream_.resize(waitingTaskPerStream_.capacity());
269271
}
270272
const unsigned int nWaitingEvents_;
271273
std::unique_ptr<std::thread> serverThread_;

0 commit comments

Comments
 (0)