How to kill a java thread?

前端 未结 8 1982
一个人的身影
一个人的身影 2020-12-11 08:26

I google the solution for killing a java thread. And there exists two solutions:

  1. set a flag
  2. using Thread.interrupt

But both of them ar

8条回答
  •  一个人的身影
    2020-12-11 09:12

    Spawn a separate process and kill it using OS facilities. You'll have to call into "C" to do it but it won't be much code. You didn't say what OS you are running on.

提交回复
热议问题