1
I have the following scenario: Three types of threads can be created in the program, imagine they are, A, B and C. I have to respect the following rule:
A thread C not can access the critical region if there is already one or more threads B running and vice versa. (A threads can run regardless of how many or which others are also running)
My question is: What is the most efficient way to implement it in C#?
What do you mean critical region? Are you referring to a shared variable?
– rodrigogq
What is the difference between threads A and B? By Description, it seems to me that both can run the critical region without restrictions.
– dcastro
The problem is an adaptation of the Unisex Bathroom Problem by my teacher. Suppose threads of type C are men and B women. They can run the critical region, but never at the same time.
– lys