Skip to content

Commit f67cae8

Browse files
committed
Merge #109: example: Add missing thread.join() call so example can exit cleanly
70b2d87 example: Add missing thread.join() call so example can exit cleanly (Ryan Ofsky) Pull request description: Problem was pointed out by TheCharlatan in #107 (comment) ACKs for top commit: TheCharlatan: ACK 70b2d87 Tree-SHA512: 18a9642ca4579f5299264d1706556c9adff9794b191da24d1d997897fc7e46d4779cebf188453ecc60d671bc7bafca13fc8e756e229623ee983c574d3db0adbd
2 parents 8bb6eab + 70b2d87 commit f67cae8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

example/example.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,17 @@ int main(int argc, char** argv)
4949
auto calc = calc_init->makeCalculator(printer_init->makePrinter());
5050
while (true) {
5151
std::string eqn;
52-
std::cout << "Enter the equation: ";
52+
std::cout << "Enter the equation, or \"exit\" to quit: ";
5353
std::getline(std::cin, eqn);
54+
if (eqn == "exit") break;
5455
calc->solveEquation(eqn);
5556
}
5657
calc.reset();
5758
calc_init.reset();
5859
mp::WaitProcess(calc_pid);
5960
printer_init.reset();
6061
mp::WaitProcess(printer_pid);
62+
loop_thread.join();
63+
std::cout << "Bye!" << std::endl;
6164
return 0;
6265
}

0 commit comments

Comments
 (0)