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
Input: Batched reads & batched table allocations #1346
Conversation
A good night's sleep does wonder ;).
We're looping anyway, so the size isn't terribly important.
We know exactly how many fields we'll need.
No need for pointer shenanigans, read already returns a byte count
(I'll punt the debug printfs after dinner ;)). |
Not terribly useful logic-wise, unlike in waitForEvent, but at least it makes stuff consistent.
return 2; // false, errno | ||
} | ||
if (len == 0) { | ||
// Should never happen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol
ffi/posix_h.lua
Outdated
pcall(ffi.load, "/lib/librt.so.1", true) | ||
-- NOTE: There's no librt.so symlink, so, specify the SOVER, but not the full path, | ||
-- in order to let the dynamic loader figure it out on its own. | ||
pcall(ffi.load, "rt.so.1", true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Just letting you know this keeps working on my GloHD.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks ;).
I'd checked with a dummy library and a strace that it was indeed following all the crazy stock paths, but glad to have a confirmation ;).
Wheeee \o/
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 3 files at r1, 3 of 3 files at r3.
Dismissed @poire-z from a discussion.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @NiLuJe)
ffi/posix_h.lua, line 165 at r2 (raw file):
Previously, NiLuJe (NiLuJe) wrote…
Cool, thanks ;).
I'd checked with a dummy library and a strace that it was indeed following all the crazy stock paths, but glad to have a confirmation ;).
Done.
Requires koreader/koreader-base#1344 & koreader/koreader-base#1346 (fix #7485) Assorted input fixes: * Actually handle errors in the "there's a callback timer" input polling loop. * Don't break timerfd when the clock probe was inconclusive. Not directly related, but noticed because of duplicate onInputEvent handlers: * HookContainer: Fix deregistration to actually deregister properly. "Regression" extant since its inception in #2933 (!). * Made sure the three plugins (basically the trio of AutoThingies ;p) that were using HookContainer actually unschedule their task on teardown.
Okay, turns out, reading the full batch of events at once (or at least in as few `read` as possible) isn't too gnarly, and allows us to do nifty things with Lua table allocations, by telling Lua exactly how many elements we're going to insert. Also, fix loading librt on multilib systems.
Okay, turns out, reading the full batch of events at once (or at least in as few
read
as possible) isn't too gnarly, and allows us to do nifty things with Lua table allocations, by telling Lua exactly how many elements we're going to insert.This change is