Exceptions in multithreaded application.

前端 未结 10 1553
春和景丽
春和景丽 2021-02-15 00:02

I have heard from a very discerning person that an exception being thrown (and not caught) in a thread is being propagated to the parent thread. Is that true? I have tried some

10条回答
  •  感情败类
    2021-02-15 00:07

    In short, no it doesn't. You have a couple of obvious options:#

    1. log it out in the method your new thread starts (top of the stack for the created thread) in.
    2. Use a construct like Asynchronous delegate, which will will return an exception when you call end invoke, which you can then catch in the normal way.

提交回复
热议问题