From the course: Parallel and Concurrent Programming with C++ Part 1

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Abandoned lock

Abandoned lock - C++ Tutorial

From the course: Parallel and Concurrent Programming with C++ Part 1

Start my 1-month free trial

Abandoned lock

- Now that we've figured out how to avoid a deadlock between our two philosophers using chopsticks, we can return to our routine of eating and philosophizing. I'm ready for another piece of sushi, so I'll pick up the first chopstick, then the second one, and I think I left the refrigerator open. - Well, that was rude of him. We've entered another form of a deadlock through thread death. If one thread, or process, acquires a lock and then terminates because of some unexpected reason, it may not automatically release the lock before it disappears. That leaves other tasks like me stuck waiting for a lock that will never be released and getting hungry. - Sorry about that. Let's look at some code.

Contents