...

/

Better, But Still Broken: While, Not If

Better, But Still Broken: While, Not If

Let's try to work on the solution of the producer/consumer problem from the last lesson.

In the last lesson, we saw how the solution we came up with for the producer/consumer problem did not work correctly for more than one consumer due to the race condition. Fortunately, fixing it is easy (see the code excerpt below): change the if to a while.

Access this course and 1400+ top-rated courses and projects.