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

Update for new polling breaking changes #141

Merged
merged 5 commits into from
Sep 10, 2023

Conversation

notgull
Copy link
Member

@notgull notgull commented Jul 11, 2023

For now, this exists as a testing ground in order to test smol-rs/polling#123 before we release it.

@ids1024 ids1024 mentioned this pull request Jul 11, 2023
@ids1024
Copy link
Member

ids1024 commented Jul 11, 2023

So, this makes Generic safe by having Drop and unwrap automatically unregister it from the event loop?

Interesting approach. Normally relying on Drop for safety properties is unsound, with mem::forget or reference cycles, but in this particular instance it's fine since that will also leak the fd. (In other words, I tried to break this and get it to poll an invalid fd using Generic, but I couldn't. So it looks sound.)

But this does mean that if a user of calloop implements EventSource to call Poll::register etc. directly, it should also implement Drop like this to ensure the same safety properties?

@notgull
Copy link
Member Author

notgull commented Jul 15, 2023

The only thing that matters is that the source isn't dropped while registered in a Poller. If anyone were to implement a similar abstraction to this, they would need to either follow these dropping rules or otherwise make sure that drop() isn't called before deregister().

@notgull notgull marked this pull request as ready for review September 5, 2023 04:04
@notgull
Copy link
Member Author

notgull commented Sep 5, 2023

I've updated this for the new polling release.

@codecov
Copy link

codecov bot commented Sep 5, 2023

Codecov Report

Patch coverage: 82.69% and project coverage change: +0.17% 🎉

Comparison is base (d468cc9) 88.79% compared to head (4e805d6) 88.97%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #141      +/-   ##
==========================================
+ Coverage   88.79%   88.97%   +0.17%     
==========================================
  Files          14       14              
  Lines        1669     2140     +471     
==========================================
+ Hits         1482     1904     +422     
- Misses        187      236      +49     
Flag Coverage Δ
macos-latest 85.86% <71.08%> (-2.60%) ⬇️
ubuntu-latest 86.35% <81.25%> (-2.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/sources/generic.rs 75.63% <67.85%> (-3.25%) ⬇️
src/io.rs 78.09% <100.00%> (-4.46%) ⬇️
src/sources/signals.rs 82.29% <100.00%> (+1.83%) ⬆️
src/sys.rs 99.20% <100.00%> (+0.79%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@notgull
Copy link
Member Author

notgull commented Sep 5, 2023

Ugh, looks like Github Actions is down.

@elinorbgr
Copy link
Member

Alright, the CI is back. Also, even if git does not see any conflict, could you rebase on master for good measure?

Signed-off-by: John Nunley <[email protected]>
@elinorbgr
Copy link
Member

Okay, this looks good overall, but could you give more details about the NoIoDrop type that you introduced? Mostly what is its role and why is it needed? If possible as code/docs comments around this type, to make future maintainability easier.

Copy link
Member

@elinorbgr elinorbgr left a comment

Choose a reason for hiding this comment

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

Perfect, thanks!

@elinorbgr elinorbgr merged commit 9999520 into Smithay:master Sep 10, 2023
11 of 12 checks passed
@notgull notgull deleted the new-polling branch September 10, 2023 18:00
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