Python thread exit code

后端 未结 3 701
太阳男子
太阳男子 2021-02-19 03:14

Is there a way to tell if a thread has exited normally or because of an exception?

3条回答
  •  迷失自我
    2021-02-19 03:59

    Have your thread function catch exceptions. (You can do this with a simple wrapper function that just calls the old thread function inside a try...except or try...except...else block). Then the question just becomes "how to pass information from one thread to another", and I guess you already know how to do that.

提交回复
热议问题