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

Allow use of SignalFd through shared reference #2367

Merged
merged 1 commit into from
Apr 13, 2024

Conversation

zopsicle
Copy link
Contributor

@zopsicle zopsicle commented Apr 13, 2024

Like with many other file descriptors, concurrent use of signalfds is safe. Changing the signal mask of and reading signals from a signalfd can now be done with the SignalFd API even if other references to it exist.

Fixes #2366.

What does this PR do

Checklist:

  • I have read CONTRIBUTING.md
  • I have written necessary tests and rustdoc comments
  • A change log has been added if this PR modifies nix's API

@zopsicle zopsicle marked this pull request as ready for review April 13, 2024 10:44
Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

It looks like these interfaces take mutable references since they were introduced to Nix, that was 9 years ago: 36432e1#diff-334c9af19669019c937e142276a7b1edf82495d5c5b2fba3351b0a56d041892b

@SteveLauC
Copy link
Member

Could you please rebase your branch, the CI failure should be fixed in #2368

Like with many other file descriptors, concurrent use of signalfds is safe.
Changing the signal mask of and reading signals from a signalfd can now be done
with the `SignalFd` API even if other references to it exist.

Fixes nix-rust#2366.
@zopsicle
Copy link
Contributor Author

Rebased on latest master.

@SteveLauC SteveLauC added this pull request to the merge queue Apr 13, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 13, 2024
@SteveLauC SteveLauC added this pull request to the merge queue Apr 13, 2024
Merged via the queue into nix-rust:master with commit bae5fdb Apr 13, 2024
38 checks passed
@zopsicle
Copy link
Contributor Author

Thanks!

@zopsicle zopsicle deleted the signalfd-no-mut branch April 13, 2024 11:47
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.

SignalFd::read_signal should take &self, not &mut self
2 participants