In your answer you have the procude method set the flag to falseThe produce method simply sets the flag to true and notifies anybody who has called wait.
in the given anser it will wait if is is true...If it is not true, it waits until it is notified by the produce method
if false, the flag is set to true in the given answer.If it is true, it simply sets it to false.
This statements and answers confuse me, you cou clarify?
Thanks
Aleks