通過例子simpledb來展現(xiàn)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