Thread processing

Assume that thread A creates thread B, and over time, thread B crashes with the problem. Is it likely that the control will return to stream A in language C. The kind of exceptional processing.

+4
source share
3 answers

Not. "Control pass back" does not make much sense, because they are executed independently in any case - as a rule, Thread A is not going to sit waiting for Thread B to complete, but it will do something else.

By the way, threads can, of course, check if another thread is working. Check your thread library or the system functions you use.

However, this will only work on what can be called a โ€œsoft glitchโ€; many crashes screw much more than just a thread doing a bad thing, such as hardware exceptions that kill the whole process or corrupt memory. Thus, trying to catch failures in another thread will be a good job with little benefit, if any. Better spend this time fixing bugs.

+4
source

Not. These are separate threads of execution. Once thread A has created and started thread B, both A and B can execute independently.

Of course, if thread B flushes the whole process, thread A will no longer exist ...

+3
source

Themes cannot call other threads, but only signal them. The โ€œnormalโ€ / function call / return method is stack-based, and each thread has its own stack (very often the exact same code is executed for several threads using different stack autostatistics variables).

If a thread cannot call another thread, then there is no "return" from one thread to another.

0
source

All Articles