mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-23 09:22:30 +00:00
LibCore: Always reset the polled revents
field back to 0
One benefit of using `poll` over `select` is that we can re-use the poll structure list. But there's no guarantee that the underlying system will reset the `revents` field back to 0. So let's explicitly do so.
This commit is contained in:
parent
0499d216b8
commit
f46b721c57
Notes:
github-actions[bot]
2025-07-07 21:54:20 +00:00
Author: https://github.com/ADKaster
Commit: f46b721c57
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5331
1 changed files with 5 additions and 1 deletions
|
@ -739,10 +739,14 @@ ErrorOr<ByteString> readlink(StringView pathname)
|
|||
|
||||
ErrorOr<int> poll(Span<struct pollfd> poll_fds, int timeout)
|
||||
{
|
||||
for (auto& poll_fd : poll_fds)
|
||||
poll_fd.revents = 0;
|
||||
|
||||
auto const rc = ::poll(poll_fds.data(), poll_fds.size(), timeout);
|
||||
if (rc < 0)
|
||||
return Error::from_syscall("poll"sv, errno);
|
||||
return { rc };
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
unsigned hardware_concurrency()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue