In your case, the debug is simple, just by inspection: the
zero
method (
t1
) unlocks
sOdd
and then exits. Then the
odd
method (
t3
) terminates (because
sOdd
is unlocked). The
even
method has no chance to exit, because
sEven
is still locked.
You can observe such a behavior adding messages at the end of the methods:
void zero(std::function<void(int)> printNumber) {
cout << "zero terminating\n";
}
and so on.