add message queue

This commit is contained in:
云风
2013-10-30 19:30:06 +08:00
parent 09242894a3
commit 0b9d7d8a62
4 changed files with 84 additions and 2 deletions

12
service/pingqueue.lua Normal file
View File

@@ -0,0 +1,12 @@
local skynet = require "skynet"
local mqueue = require "mqueue"
skynet.start(function()
local id = 0
local pingserver = skynet.newservice "pingserver"
mqueue.register(function(str)
id = id + 1
str = string.format("id = %d , %s",id, str)
return skynet.call(pingserver, "lua", "PING", str)
end)
end)