[英]pThreads on Win 7 and Win10
I can't install/add pthreads to my Win7 and Win10 xampp. 我无法在我的Win7和Win10 xampp上安装/添加pthread。 I downloaded the release: 我下载了这个版本:
http://windows.php.net/downloads/pecl/releases/pthreads/ http://windows.php.net/downloads/pecl/releases/pthreads/
unpacked the extension dll (php_pthreads.dll) to extension directory and the runtime dll (pthreadVC2.dll) to php directory (same dir as php.exe) and add extension=php_pthreads.dll to my configuration, but still it doesn't work. 将扩展名dll(php_pthreads.dll)解压缩到扩展目录,将运行时dll(pthreadVC2.dll)解压缩到php目录(与php.exe相同的目录)并将extension = php_pthreads.dll添加到我的配置中,但仍然无法正常工作。
What to do? 该怎么办?
Thanks for the answer. 感谢您的回答。
Nebojša 内博伊沙·
Windows supporting threads at all would be news to me. Windows支持线程对我来说都是新闻。 The P in pthreads stands for POSIX, like Unix. pthreads中的P代表POSIX,就像Unix一样。
This is a different direction, but perhaps the Windows Subsystem for Linux would be worth investigating. 这是一个不同的方向,但也许适用于Linux的Windows子系统值得研究。 It is supposed to provide a basic degree of POSIX compatibility to a Windows environment. 它应该为Windows环境提供基本程度的POSIX兼容性。
First, 第一,
Did you restart Apache after adding the module ? 添加模块后重新启动Apache了吗? If not, you should do it. 如果没有,你应该这样做。
Next, Try the basic php multithreaded program 接下来,尝试基本的php多线程程序
<?php
class AsyncOperation extends Thread {
public function __construct($arg){
$this->arg = $arg;
}
public function run(){
if($this->arg){
printf("Hello %s\n", $this->arg);
}
}
}
$thread = new AsyncOperation("World");
if($thread->start())
$thread->join();
?>
You seem to have followed all the necessary steps. 您似乎已经遵循了所有必要的步骤。 Should be straightforward from there. 从那里应该是直截了当的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.