Skip to content

Commit 70b2d87

Browse files
committed
example: Add missing thread.join() call so example can exit cleanly
Problem was pointed out by TheCharlatan <[email protected]> in #107 (comment)
1 parent 8bb6eab commit 70b2d87

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)