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

Implement AsRawFd for EventLoop<'l, Data> #159

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

kchibisov
Copy link
Member

This should allow inserting one EventLoop into the other.

@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (342ef70) 86.65% compared to head (86d4026) 86.39%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #159      +/-   ##
==========================================
- Coverage   86.65%   86.39%   -0.26%     
==========================================
  Files          16       16              
  Lines        1933     1941       +8     
==========================================
+ Hits         1675     1677       +2     
- Misses        258      264       +6     
Flag Coverage Δ
macos-latest 85.47% <25.00%> (-0.28%) ⬇️
ubuntu-latest 85.95% <25.00%> (-0.27%) ⬇️

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

Files Coverage Δ
src/sys.rs 92.18% <ø> (ø)
src/loop_logic.rs 85.37% <25.00%> (-1.29%) ⬇️

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

@elinorbgr
Copy link
Member

I'm thinking that if we're going that route, we could even add an AsFd impl, as well as an EventSource that does the composition (and tests for that).

@kchibisov
Copy link
Member Author

The issue with AsFd is that the inner Poller is inside the Rc<RefCell<..>> chain, so returning something with the lifetime doesn't work because of that.

The only way would be to clone fd, but that's about it.

@notgull
Copy link
Member

notgull commented Oct 9, 2023

The issue with AsFd is that the inner Poller is inside the Rc<RefCell<..>> chain, so returning something with the lifetime doesn't work because of that.

The only way would be to clone fd, but that's about it.

The Poller is inside of an Arc, so it can be cheaply cloned to the main structure and used from there.

This should allow inserting one `EventLoop` into another.
@kchibisov
Copy link
Member Author

The Poller is inside of an Arc, so it can be cheaply cloned to the main structure and used from there

That's fair. Fixed.

@elinorbgr
Copy link
Member

The issue with AsFd is that the inner Poller is inside the Rc<RefCell<..>> chain, so returning something with the lifetime doesn't work because of that.

Actually, it looks like this RefCell is an artifact of the past that is no longer needed, all the methods of Poll take a &self, so I think this RefCell can just be removed.

@kchibisov
Copy link
Member Author

Actually, it looks like this RefCell is an artifact of the past that is no longer needed, all the methods of Poll take a &self, so I think this RefCell can just be removed.

The problem is not methods on the Poll but methods taking &mut Poll. Refactoring them is a breaking change, which you can do separately to what I'm doing here.

@elinorbgr elinorbgr merged commit 04463bf into Smithay:master Oct 10, 2023
10 of 12 checks passed
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