Doubt Multithreading in C #

1

I have the following scenario: You can create three types of threads in the program, imagine that they are A, B and C. I have to respect the following rule:

A C thread can not access the critical region if there are already one or more B threads running and vice versa . (Threads A can run regardless of how many or which ones are also running)

My question is: What is the most efficient way to implement it in C #?

    
asked by anonymous 08.12.2014 / 19:24

1 answer

3

When firing Thread C check if Thread B is running using the:

Thread.IsAlive

If false, it performs Thread C procedures.

    
08.12.2014 / 19:47