jjzjj

pThreads

全部标签

PHP Pthread - 无法获取 DOMDocument

我正在尝试编写php线程代码。我正在构造函数中创建一个DOMDocument,但由于某种原因,新创建的文档虽然已分配给成员变量,但却消失了。代码list1:classworkerThreadextendsThread{private$document;private$i;publicfunction__construct($i){$this->document=newDOMDocument();$this->i=$i;}publicfunctionrun(){try{$root=$this->document->createElement("Root");//can'tfetchthi

php - PHP 线程应该如何存储它的数据?

所以我一直在网上搜索和阅读有关PHPpthreads3以及它们应该如何存储数据的信息。(或者更确切地说,他们不是)在我看来,线程正确存储其数据的唯一方法是创建一个新的Threaded对象并将其发送给线程。然后线程可以使用这个Threaded对象来存储几乎所有数据。我的问题,也是掌握PHP线程的最大问题:是否可以让线程在需要时创建自己的存储对象?我不知道如何或为什么,因为我在这个问题上找到的所有答案都含糊不清、详尽且令人困惑“也许,但不是”,主要与性能不佳和内存问题/安全性有关。这似乎应该是可能的,不知何故:classsomeFantasticThreadextendsThread{pu

php - Pool::collect 是如何工作的?

帮助我了解Pool::collect的工作原理。Pool::collect—收集对已完成任务的引用publicvoidPool::collect(Callable$collector)我的假设是:Pool::collect注册一个函数,该函数将在每个\Threaded$task完成后调用。所以,我做了:collect($collector);$pool->submit(newTask);没用。但以下内容确实如此:submit(newTask);$pool->collect($collector);所以,我想Pool::collect所做的是:将$collector附加到之前提交的每个\

php - 如何让 pthreads 在 PHP 中工作?

我正在使用wampserver在我的本地计算机上测试和运行wordpress代码。为了运行pthread,我遵循了以下步骤:1)我从http://windows.php.net/downloads/pecl/releases/pthreads/0.44/得到了pthreadzip文件(我的机器有php5.3.13并从上面的链接下载了php_pthreads-0.44-5.3-ts-vc9-x86.zip文件)。2)解压缩zip文件。将php_pthreads.dll移动到C:\wamp\bin\php\php5.3.13\ext目录。3)将pthreadVC2.dll移动到C:\wam

PHP-FPM 和 pthreads

我正在使用PHP-FPM运行Phalcon应用程序,并且刚刚安装了pthreads,因此我可以开始异步运行任务。我目前有pthreads使用命令行界面工作:workerId=$id;}publicfunctionrun(){usleep(2000000);//2secondsecho"Worker{$this->workerId}ran".PHP_EOL;}}//Workerpool$workers=[];//Initializeandstartthethreadsforeach(range(0,5)as$i){$workers[$i]=newWorkerThreads($i);$wo

php - 将参数从主线程传递到新线程

在PHP中,如何使用扩展pthreads将参数从主线程传递到新线程?类似于此的内容HowcanIpassaparametertoaJavaThread?仅在PHP中。 最佳答案 从这段代码开始:http://www.php.net/manual/en/thread.start.phpdata="something";//PasssomethingtotheThreadbeforeyouactuallystartit.var_dump($my->start());?> 关于php-将参数从

php - Apache2,线程。 fatal error 。 pthreads 不支持 apache2handler SAPI

我的ubuntu上有apache2网络服务器。我需要安装pthreads,所以我从rep(复制到/ext/)克隆了php7和pthreads的源代码。我为php安装了所有库,然后运行​​./buildconf和./configure--prefix=/usr--with-config-file-path=/etc--enable-bcmath--enable-calendar--enable-cli--enable-debug--enable-dba--enable-exif--enable-ftp--enable-gd-native-ttf--enable-mbregex--enab

php - 在 Ubuntu 上的 PHP+Apache2 中启用线程安全 - 使用 pthreads 从源代码编译 php

在我通过apt-get安装Apache2和PHP5后,我试图让pthreads在我的Ubuntu服务器(14.04)上运行。我的初始步骤:已安装apache2-apt-getinstallapache2使用常用模块安装php5apt-getinstallphp5libapache2-mod-php5php5-mcrypt...然后我按照本教程让pthreads运行(Usercontributedmanualonphp.net):1-GetPHPversionForthisexamplewewilluseversion:5.4.36#wgethttp://www.php.net/dist

php - PHP Pthread 类中的 Yii 框架上下文

我正在研究PHPPthreads.我写了一个继承“Thread”类的类。此类不识别Yii(1.x)框架上下文。我不能使用任何Yii框架组件或模型。我已经确保线程类应该驻留在Yii框架的可访问路径中,该路径在配置的“导入”中定义。这是我如何编写线程类的示例。basePath;}}更新:这是Yii配置中的导入器数组。'import'=>array('application.models.*','application.components.*','application.components.multithreaded-operations.*','application.componen

php - 如何使用 pthreads 重新编译 PHP7

我已经安装并正常运行php7buildwith-enable-zts(https://github.com/rlerdorf/php7dev)现在我需要添加pthreads扩展(https://github.com/krakjoe/pthreads),但出现一些错误:Infileincludedfrom/home/pthreads/php_pthreads.c:47:0:./src/copy.h:113:8:error:unknowntypename‘zend_live_range’staticzend_live_range*pthreads_copy_live(zend_live_r