Is it possible to kill a spinning thread?

前端 未结 9 1489
遥遥无期
遥遥无期 2021-01-20 19:09

I am using ZThreads to illustrate the question but my question applies to PThreads, Boost Threads and other such threading libraries in C++.

class MyClass: p         


        
9条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-20 19:27

    It is possible to terminate a thread forcefully, but the call to do it is going to be platform specific. For example, under Windows you could do it with the TerminateThread function.

    Keep in mind that if you use TerminateThread, the thread will not get a chance to release any resources it is using until the program terminates.

提交回复
热议问题