There are 3 tools. A consumer needs 2 tools to modify the buffer. If consumer A takes the 2 tools and consumer B takes 1, consumer B will have to wait for another tool to be released.
I am not sure if I'm thinking about this problem in the right way. The way I interpret it is that I need 3 mutex and the consumer has to lock 2 out 3, is this the right idea?
I don't think I should be using semaphores because I don't want multiple threads accessing a shared resource at the same time. In a normal producer consumer problem there is just 1 mutex lock but here I need any 2 of the 3 how do I approach this?