Skip to content
Advertisement

What’s alternate for Pthreads::kill() about Thread class of pthreads version 3

The kill() method has been removed from PECL pthreads library version 3.

See manual from archive: https://web.archive.org/web/20210410123359/https://www.php.net/manual/en/thread.kill.php

Warning: This method has been removed in pthreads v3.
Warning: The programmer should not ordinarily kill Threads by force.

So as you can see removed in new version: https://www.php.net/manual/en/class.thread.php

Now what’s alternate for kill or terminate the proccess from out of class that started with the Thread class?

Advertisement

Answer

There is no alternative. This method was removed exactly because it’s not safe to kill a thread like this using pthreads. Check this and this issue in the pthreads repository for more details and possible workarounds.

Since pthreads was discontinued, I recommend switching to the new parallel extension. It has a kill method.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement