Process->setBlocking

    • $blocking 布尔型,默认为true,设置为false时管道为非阻塞模式
    • 在异步程序中使用swoole_event_write异步写入数据时底层会自动将管道设置为非阻塞

    使用实例

    1. $serv->on("WorkerStart", function () use ($process) {
    2. //设置为阻塞模式
    3. while(true) {
    4. $process->write("hello");
    5. $msg = $process->read();