-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We need wait_any/wait_all mechanism on subset of channels and condvars #5635
Comments
There are at least 2 approaches of how to implement such a feature. Poll-like and epoll-like. Poll-likeIt is similar to Linux system call Applied to Maybe it work work fine if cond count is tiny. But problems arise when the cond count becomes tens, hundreds, thousands, or more.
Moreover, Therefore, I would recommend to consider it a dead end. Epoll-likeIt is similar to Linux system call Strong side here is that you don't need to pass all the descriptors to Applied to
When you signal a Wake of a To use the To remove a cond from the mesh you do In that way it costs just + some small constant overhead for each cond, but makes I think this is the way to go. Also this can be designed so as we could make nested meshes. Like nested epoll descriptors. Or even make each cond like a mesh. A tree of conds. This can be evolved from the design above. |
I suppose it is worth considering a more general construction that will work with channels by analogy as it is done with select in golang. local select = fiber.select{ch1, cond1, cond2}
select.add(ch2)
select.remove(cond2)
-- other fiber
local data, ch = select.pick(5) -- wait for 5 second
f2(data) -- any case
if ch == ch2 then f1(data) end
if ch == nil then log("timeout") end
if ch == cond2 then return end But in this case, it need to determine how this function should behave |
I could use it in vshard. While working on tarantool/vshard#147 I realized I need to signal a lot of events to catch in a lot of places. The only 2 choices I have now - add a single cond which would be signaled on anything important (leading to tons of spurious wakeups of storage internal fibers), or implement my own cond-tree purely on |
There are applications when we have subset of sources of data which triggers own condvars/channels. In global application architecture we have to wait for
any
events from subsets of these condvars/channels to pass data to the client. Now we may implement own tree of the condvars and channels based on fiber.cond() and fiber.channel() in Lua to achive required interface of communication. Maybe Core-based implementation will be fasterThe text was updated successfully, but these errors were encountered: