Last active
August 10, 2021 08:09
-
-
Save dndx/8539137ddbdc804a31c1b667158c7efe to your computer and use it in GitHub Desktop.
semaphore_bug.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local sema = require("ngx.semaphore") | |
local s = sema.new() | |
local function do_post() | |
s:post() | |
--ngx.sleep(0) | |
print("posted") | |
end | |
ngx.timer.at(0, function() | |
ngx.timer.at(0, do_post) -- this fails | |
--do_post(s) -- this works | |
print(s:wait(5)) | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
just tried this, might be a bit better than pushing IO