Process->setBlocking
$blocking
布尔型,默认为true
,设置为false
时管道为非阻塞模式
- 在异步程序中使用
swoole_event_write
异步写入数据时底层会自动将管道设置为非阻塞
使用实例
$serv->on("WorkerStart", function () use ($process) {
//设置为阻塞模式
while(true) {
$process->write("hello");
$msg = $process->read();