Better, But Still Broken: While, Not If

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

We'll cover the following

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.

Get hands-on with 1400+ tech skills courses.