当前位置:网站首页>About the swoole coroutine container
About the swoole coroutine container
2022-06-25 23:48:00 【ndrandy】
To use a coroutine API, Must be in the process container , So how to create a collaboration container ? Outermost layer go In closure , perhaps \Co\Run() In closure , You have created a coroutine container
<?php
go(function(){ // This is used here \Co\Run Equally effective
// In the current closure , Even if the process environment , In general , Root Xiecheng cid = 1
for ($i=0;$i<10;$i++) {
go(function(){
// Subprocess environment
})
}
// Here, you must wait until the execution of all sub process environments is completed
});
// The current location is not a co process environment , This is where the code ends
Bear in mind !!! In a collaborative environment , Never use sleep, Otherwise, the global or static variables are dirty , Whether or not you use the context manager to isolate the process .
The current schedule co::sleep() It will only affect the current collaboration process , It will not affect the switching time of the coordination process scheduling and the running time of other coordination processes
There is nesting in the process , The parent process must wait for all the child processes to run , To quit
边栏推荐
- 平衡二叉树AVL
- Extraction system apk
- 7.常用指令(下)v-on,v-bind,v-model的常见操作
- Summary of common JDBC exceptions and error solutions
- Jenkins releases PHP project code
- unsigned与signed之大白话
- 第五章 习题(124、678、15、19、22)【微机原理】【习题】
- Hbuilderx uses the gaude map to obtain the current location
- Screen recording to GIF is an easy-to-use gadget, screentogif, which is free and easy to use!
- Kotlin null pointer bug
猜你喜欢
Unable to start debugging. Unexpected GDB output from command “-environment -cd xxx“ No such file or
如何设计产品的roadmap?
Analyse des cinq causes profondes de l'échec du développement de produits
一文讲透研发效能!您关心的问题都在
CXF
第五章 习题(124、678、15、19、22)【微机原理】【习题】
7.常用指令(下)v-on,v-bind,v-model的常见操作
idea Kotlin版本升级
森林的先序和中序遍历
Hibernate core api/ configuration file / L1 cache details
随机推荐
发送邮件工具类
28 rounds of interviews with 10 companies in two and a half years (including byte, pinduoduo, meituan, Didi...)
CSDN force value
Stream in PHP socket communication_ Understanding of select method
Solving typeerror: Unicode objects must be encoded before hashing
php性能优化
A. Balance the Bits--Codeforces Round #712 (Div. 1)
C2. k-LCM (hard version)-Codeforces Round #708 (Div. 2)
Talk about how to hot restart a spoole or PHP cli process
Jenkins 发布PHP项目代码
Use Baidu map API to set an overlay (infowindow) in the map to customize the window content
二进制、16进制、大端小端
MySQL自定义函数实例
Database - mongodb
Record the ideas and precautions for QT to output a small number of pictures to mp4
Apache Doris1.0版本集群搭建、负载均衡与参数调优
期末复习【机器学习】
IDEA中如何生成get/set方法
YUV444、YUV422、YUV420、YUV420P、YUV420SP、YV12、YU12、NV12、NV21
xtrabackup的备份还原