We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b003c2f commit 5674377Copy full SHA for 5674377
changelog/2563.added.md
@@ -0,0 +1 @@
1
+Added `from_owned_fd` constructor to `EventFd`
src/sys/eventfd.rs
@@ -58,6 +58,15 @@ impl EventFd {
58
Self::from_value_and_flags(init_val, EfdFlags::empty())
59
}
60
61
+ /// Constructs an `EventFd` wrapping an existing `OwnedFd`.
62
+ ///
63
+ /// # Safety
64
65
+ /// `OwnedFd` is a valid eventfd.
66
+ pub unsafe fn from_owned_fd(fd: OwnedFd) -> Self {
67
+ Self(fd)
68
+ }
69
+
70
/// Enqueues `value` triggers, i.e., adds the integer value supplied in `value`
71
/// to the counter.
72
///
@@ -106,4 +115,4 @@ impl From<EventFd> for OwnedFd {
106
115
fn from(value: EventFd) -> Self {
107
116
value.0
108
117
109
-}
118
+}
0 commit comments