pthreads for PHP not executing parallel threads in Apache

≯℡__Kan透↙ 提交于 2019-12-03 07:12:48

Nothing is simulated, you are executing real threads.

You should not write the standard output from threads in SAPI mode, you will experience unexpected behaviour and errors, that cannot be controlled, there are too many environments and SAPI's to cover it well, so it is not covered at all, don't do it.

Even in CLI mode output of complex code will be garbled, to work around this, you can define a protected method in any object you pass to all contexts that takes care of writing standard output, if the method is protected and the object is a pthreads one, only one context will be able to write standard output at a time ... the same object could be used in the SAPI environment by swapping standard output for a logging database ...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!