Skip to content
Snippets Groups Projects
Commit b57d6115 authored by Roman Tsisyk's avatar Roman Tsisyk
Browse files

box/fiber.test.lua: stop flooding the logs during busy-wait

parent b63ae574
No related branches found
No related tags found
No related merge requests found
......@@ -610,11 +610,8 @@ test_run:cmd("setopt delimiter ';'")
---
- true
...
function testfun(ch)
while fiber.self().storage.key == nil do
print('wait')
fiber.sleep(0)
end
function testfun(mgmt, ch)
mgmt:get()
ch:put(fiber.self().storage.key)
end;
---
......@@ -623,15 +620,22 @@ test_run:cmd("setopt delimiter ''");
---
- true
...
ch = fiber.channel(1)
mgmt = fiber.channel()
---
...
f = fiber.create(testfun, ch)
ch = fiber.channel()
---
...
f = fiber.create(testfun, mgmt, ch)
---
...
f.storage.key = 'some value'
---
...
mgmt:put("wakeup plz")
---
- true
...
ch:get()
---
- some value
......@@ -639,9 +643,15 @@ ch:get()
ch:close()
---
...
mgmt:close()
---
...
ch = nil
---
...
mgmt = nil
---
...
fiber.self().storage.key -- our local storage is not affected by f
---
- 48
......
......@@ -223,20 +223,21 @@ fiber.self().storage.key = 48
fiber.self().storage.key
test_run:cmd("setopt delimiter ';'")
function testfun(ch)
while fiber.self().storage.key == nil do
print('wait')
fiber.sleep(0)
end
function testfun(mgmt, ch)
mgmt:get()
ch:put(fiber.self().storage.key)
end;
test_run:cmd("setopt delimiter ''");
ch = fiber.channel(1)
f = fiber.create(testfun, ch)
mgmt = fiber.channel()
ch = fiber.channel()
f = fiber.create(testfun, mgmt, ch)
f.storage.key = 'some value'
mgmt:put("wakeup plz")
ch:get()
ch:close()
mgmt:close()
ch = nil
mgmt = nil
fiber.self().storage.key -- our local storage is not affected by f
-- attempt to access local storage of dead fiber raises error
pcall(function(f) return f.storage end, f)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment