Simplified, I start several background threads (this is the original method), when they finish their work, they raise an event, in this case they call the original method.
When an event is raised, it runs under the stream that raised it. Before I call the source method from this event, I would like to join the main thread (or join the source method). Thus, avoid threads that can create more threads.
I think I'm worried that the original threads are never garbage collected because they caused more threads? Would that be so? and how can I make sure the thread is complete?
Please note that I guarantee that only x number of threads can execute at any time.
source
share