Skip to content
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

add support of a unix-like poll function #1046

Merged
merged 19 commits into from
Feb 5, 2024
Merged

Conversation

stlankes
Copy link
Contributor

@stlankes stlankes commented Feb 1, 2024

poll() examines a set of file descriptors to see if some of them are ready for I/O or if certain events have occurred on them. The currenty implementation is using an asynchronous function to check all file descriptors.

This PR should solve smol-rs/polling#177

Currently, the PR doesn't support file descriptors, which points to the uhyve file system.

@stlankes
Copy link
Contributor Author

stlankes commented Feb 4, 2024

@mkroening Now, you can review the PR. I added some async lock to reduce the blocking time.

poll() examines a set of file descriptors to see if some of them
are ready for I/O or if certain events have occurred on them.
The currenty implementation is using an asynchronous function to
check all file descriptors.
according to the POSIX standard, POLLNVAL should be returned,
if the socket is already closed.
This removes a blocking function within the async function `poll_fds`.
in cace, the NIC is already used by a task, the calling of poll
function isn't required.
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! 👍

@mkroening mkroening added this pull request to the merge queue Feb 5, 2024
Merged via the queue into hermit-os:main with commit b271085 Feb 5, 2024
39 checks passed
@stlankes stlankes deleted the poll branch February 5, 2024 18:01
@koraa
Copy link

koraa commented Feb 6, 2024

This is awesome 🎆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants