COEN320: Solution to Assignment #2 part 2 (deadlock)