I want to make threads in my application talk with each other. My scenario is mentioned below: (searched for this, but didn't find anything)
For instance, 10 threads are doing something. Thread 1 encounters some condition on which it will safely terminate, but I also need it to tell all other threads to stop what they are doing and terminate safely.
One way to do this is to share a variable and each thread checks this variable before doing something. The caveat is that I need to keep checking this variable at certain checkpoints.
It would be better if there was some way for thread1 to just signal others to stop what they are doing and terminate safely.
Any such package available or something else which does this without complicating things too much?
There is little you can do that is clean (but check out my last point).