bugfix: update until delete

This commit is contained in:
Cloud Wu
2014-07-29 21:22:49 +08:00
parent 434cd1ca79
commit 68a952ff17
3 changed files with 29 additions and 6 deletions

View File

@@ -10,9 +10,15 @@ skynet.start(function()
sharedata.new("foobar", { a=1, b= { "hello", "world" } })
skynet.fork(function()
skynet.sleep(300) -- sleep 3s
skynet.sleep(200) -- sleep 3s
skynet.error("update foobar")
sharedata.update("foobar", { a =2 })
skynet.sleep(200) -- sleep 3s
skynet.error("update foobar")
sharedata.update("foobar", { a = 3, b = { "change" } })
skynet.sleep(100)
skynet.error("delete foobar")
sharedata.delete "foobar"
end)
end)
@@ -47,6 +53,11 @@ skynet.start(function()
skynet.error(err)
end
-- obj. b is not the same with local b
for k,v in ipairs(obj.b) do
skynet.error(string.format("b[%d] = %s", k , tostring(v)))
end
collectgarbage()
skynet.error("sleep")
skynet.sleep(100)
@@ -55,8 +66,6 @@ skynet.start(function()
skynet.error("sleep")
skynet.sleep(100)
sharedata.delete "foobar"
skynet.exit()
end)