php pthreads 不会在 xampp 7.0.2 上启动 [英] php pthreads won't launch on xampp 7.0.2
问题描述
我已经安装了新的 xampp (7.0.2 atm).我已经创建了 php-cli.ini,在那里添加了 pthread 扩展并将内存限制设置为 3 GB.但是当我尝试启动线程脚本时,我得到了这个:
I have installed fresh xampp (7.0.2 atm). I've created php-cli.ini, added pthread extension there and set memory limit to 3 gb. But when I'am trying to launch thread script I got this:
PHP Fatal error: Uncaught RuntimeException: cannot start my_thread, out of reso
urces in C:\xampp\htdocs\w\start_threads.php:160
Stack trace:
#0 C:\xampp\htdocs\w\start_threads.php(160): Thread->start()
#1 {main}
thrown in C:\xampp\htdocs\w\start_threads.php on line 160
Fatal error: Uncaught RuntimeException: cannot start my_thread, out of resources
in C:\xampp\htdocs\w\start_threads.php:160
(我使用的是 pthreds 3.1.5 x86)我在这里做错了什么?谢谢!
(I'am using pthreds 3.1.5 x86) What am I doing wrong here? Thank you!
推荐答案
本质上是pthread_create
返回EAGAIN
造成的:表示系统缺少资源来创建另一个线程,或者系统对线程的最大数量(在一个进程中,或系统范围内)施加了限制.
Essentially, this is caused by pthread_create
returning EAGAIN
: It means that the system lacks resources to create another thread, or that the system imposed limit on the maximum number of threads (in a process, or system wide) has been reached.
这可能是由两件事引起的,由于某些软件的设计方式,故意使用比进程可以同时处理的线程更多的线程,或者更有害的是,由于线程的连接不够优雅.
This can be caused by two things, the purposeful use of more threads than a process can handle simultaneously as a result of the way some software is designed, or more perniciously, as a result of less than graceful joining of threads.
如果您似乎只是有时会遇到此类错误,则表明后者正在发生;请务必清理(显式连接)您已完成的线程,以使行为可预测.
If you only seem to hit such errors sometimes, it would suggest the latter is going on; Be sure to cleanup (explicitly join) threads you are done with to make behaviour predictable.
这篇关于php pthreads 不会在 xampp 7.0.2 上启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!