Closed ckcfcc closed 3 months ago
🤖 Non-English text detected, translating...
- Yes
- The blocking operations involved in gnet usually refer to I/O operations that may cause the kernel to transfer the current thread away from the CPU and suspend sleep, usually network I/O or disk I/O, or other operations that may be The kernel blocks pending operations. If you just do some packet/unpack operations and only access memory during the process, it is not a blocking operation.
感谢回复,gnet认知+1.
🤖 Non-English text detected, translating...
Thanks for the reply, gnet awareness +1.
Actions I've taken before I'm here
Questions with details
潘少你好,最近在我在用gnet接kcp,kcp是使用的udp通讯,我现在是在Traffic里创建kcp连接对象然后把收到的数据复制一份扔到kcp中,因为kcp需要外部时钟驱动,所以我用了OnTick作为外部时钟。
我想请教的问题有2个: 1、OnTick是不是一直被一同一个goroutine触发? 2、我在OnTraffic里创建kcp对象并收包是否算阻塞操作,是否需要用ants来开多个goroutine处理?
以上就是目前的遇到的问题,因为能力有限,阅读gnet源码后任然不知道结果,望指点
Code snippets (optional)
No response