timer wakeup

This commit is contained in:
云风
2012-08-27 12:07:19 +08:00
parent 6554e4612a
commit f425d10c8b
2 changed files with 52 additions and 7 deletions

View File

@@ -7,11 +7,19 @@ local function timeout(t)
print(t)
end
local function wakeup(co)
for i=1,5 do
skynet.sleep(50)
skynet.wakeup(co)
end
end
skynet.start(function()
skynet.timeout(500, timeout, "Hello World")
skynet.fork(wakeup, coroutine.running())
skynet.timeout(300, timeout, "Hello World")
for i = 1, 10 do
print(i)
skynet.sleep(100)
print(i, skynet.now())
print(skynet.sleep(100))
end
skynet.exit()
print("Test timer exit")