Depending on the needs of the program, I used multi-threads within a sub-thread for parallel tasking. In this "deep" multi-threading, potential problems such as timeouts and failures may be encountered.
I would like to ask, how to kill all child threads (known as "deep" multi-threading above) when one of them raise an exception or failed.
You shouldn't really be trying to kill threads.
If a thread needs to terminate because of some unrelated condition then it needs to [somehow] be notified. You just need a "flag" that's accessible to all threads.
Here's a pattern that you could adapt. It requires that each thread checks the "flag" from time to time.
The "flag" in this case is a list that contains a single arbitrary value. The run condition is true if the list is not empty.
If a problem arises in one thread it should just clear the run list. Thus all other threads will terminate.
You could make this slightly simpler by using a global variable if you're that way inclined