It works better to set TerminationFlag

That global flag is checked all over the place, so setting it will
actually make the threads eventually finish. (All polling is done with
timeout, I think, and then checking TerminationFlag whenever the poll
times out.)

Sure, it would be much better to use an eventfd and poll that, too,
instead of timing out from the polls all the time to check a plain old
boolean flag.
This commit is contained in:
Tor Lillqvist 2016-04-13 11:43:08 +03:00
parent 26ceda2f15
commit 04f3a9e111

View file

@ -1496,7 +1496,7 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
if (careerSpanSeconds > 0 && time(nullptr) > startTimeSpan + careerSpanSeconds)
{
Log::info(std::to_string(time(nullptr) - startTimeSpan) + " seconds gone, finishing as requested.");
break;
TerminationFlag = true;
}
#endif
}