I have the following problem:
A program generates two types of threads A and B through clicks on their respective buttons. Both types can not run at the same time. If I have 10 threads A, B can only execute when 10 of type A ends.
I can restrict the input by creating a mutex for each type and a Boolean variable that tells me whether there are threads of the other type being executed. However, when the first thread ends, the counter type can enter the critical thread because I am using Mutex.WaitOne ().
How can I adapt the use of 'WaitAll' for this situation? I could not fully understand the concept.