繁体   English   中英

多个system()调用在不同的线程/进程中工作吗?

[英]Does multiple system() calls works in different thread/processes?

我试图在4个线程/进程中运行我的phantomjs脚本。 想法是使用不同的参数异步运行它。 所以我在做类似的事情(循环):

$arguments = array('argument1', 'argument2', 'argument3');
foreach($arguments as $argument){
    system('phantomjs my_script.js ' . $argument . ' > output_for_' . $argument . ' 2> errors_for_' . $argument . ' &');
}

phantomjs实例可以异步工作吗? 或不 ?

编辑:顺便说一句,我知道这是非阻塞系统调用,并且php脚本继续执行-但我不确定php system()调用的每个phantomjs实例是否与另一个phantomjs实例异步。

不, system()本身不会产生新的进程或线程。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM