cond1
and cond2
.firstFinished
and secondFinished
, to False
.first()
method, acquire the lock, execute the print statement, set firstFinished
to True
, signal cond1
, and release the lock.second()
method, acquire the lock, while firstFinished
is False
, wait on cond1
, execute the print statement, set secondFinished
to True
, signal cond2
, and release the lock.third()
method, acquire the lock, while secondFinished
is False
, wait on cond2
, execute the print statement, and release the lock.