通过例子simpledb来展现skynet.call调用时coroutine的运行过程
第一步
进入skynet目录
运行服务 ./skynet examples/config
运行客户端 ./3rd/lua/lua examples/client.lua
第二步
查看客户端输入hello得到world回复这个过程中coroutine的运行过程
过程日志
skynet= 16777231 dispatch_message begin
skynet= 16777231 raw_dispatch_message begin 6 0 0
skynet= 16777231 raw_dispatch_message request co_create begin
skynet= 16777231 co_create begin
skynet= 16777231 co_create two resume function begin
skynet= 16777231 co_create EXIT end
skynet= 16777231 co_create resume function begin
skynet= 16777231 co_create two resume function end
skynet= 16777231 raw_dispatch_message request co_create end
skynet= 16777231 raw_dispatch_message request suspend begin
skynet= 16777231 co_create resume function end
skynet= 16777231 co_create EXIT begin
skynet= 16777231 suspend begin true EXIT
skynet= 16777231 raw_dispatch_message request suspend end
skynet= 16777231 raw_dispatch_message end 6 0 0
skynet= 16777231 dispatch_message end
skynet= 16777232 dispatch_message begin
skynet= 16777232 raw_dispatch_message begin 3 1 16777231
skynet= 16777232 raw_dispatch_message request co_create begin
skynet= 16777232 co_create begin
skynet= 16777232 co_create two resume function begin
skynet= 16777232 co_create EXIT end
skynet= 16777232 co_create resume function begin
skynet= 16777232 co_create two resume function end
skynet= 16777232 raw_dispatch_message request co_create end
skynet= 16777232 raw_dispatch_message request suspend begin
agetnt= 16777232 get begin hello
skynet= 16777232 skynet.call lua
skynet= 16777232 yield_call begin 4
skynet= 16777232 suspend begin true CALL
skynet= 16777232 suspend command = CALL
skynet= 16777232 raw_dispatch_message request suspend end
skynet= 16777232 raw_dispatch_message end 3 1 16777231
skynet= 16777232 dispatch_message end
skynet= 16777229 dispatch_message begin
skynet= 16777229 raw_dispatch_message begin 10 4 16777232
skynet= 16777229 raw_dispatch_message request co_create begin
skynet= 16777229 co_create begin
skynet= 16777229 co_create two resume function begin
skynet= 16777229 co_create EXIT end
skynet= 16777229 co_create resume function begin
skynet= 16777229 co_create two resume function end
skynet= 16777229 raw_dispatch_message request co_create end
skynet= 16777229 raw_dispatch_message request suspend begin
simpledb= 16777229 lua begin
skynet= 16777229 suspend begin true RETURN
skynet= 16777229 suspend command = RETURN
skynet= 16777229 suspend command = RETURN begin true
simpledb= 16777229 lua end
skynet= 16777229 co_create resume function end
skynet= 16777229 co_create EXIT begin
skynet= 16777229 suspend begin true EXIT
skynet= 16777229 suspend command = RETURN end true
skynet= 16777229 raw_dispatch_message request suspend end
skynet= 16777229 raw_dispatch_message end 10 4 16777232
skynet= 16777229 dispatch_message end
skynet= 16777232 dispatch_message begin
skynet= 16777232 raw_dispatch_message begin 1 4 16777229
skynet= 16777232 raw_dispatch_message response suspend begin
skynet= 16777232 yield_call end 4
agetnt= 16777232 get end world
skynet= 16777232 co_create resume function end
skynet= 16777232 co_create EXIT begin
skynet= 16777232 suspend begin true EXIT
skynet= 16777232 raw_dispatch_message response suspend end
skynet= 16777232 raw_dispatch_message end 1 4 16777229
skynet= 16777232 dispatch_message end
资料
http://blog.csdn.net/linshuhe1/article/details/73854411
http://www.cnblogs.com/iirecord/p/skynet_coroutine.html
https://blog.codingnow.com/2015/12/skynet_coroutine.html