File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,12 @@ pub trait ContextExt {
143
143
/// Indicate that the work should be scheduled when the given [`Queue`] has data available to
144
144
/// recv, or the timeout occurs.
145
145
fn add_queue < ' a > ( & ' a mut self , queue : & ' a Queue , timeout : impl Into < Timeout > ) ;
146
+
147
+ /// Indicate that the work should just be scheduled after the given timeout.
148
+ ///
149
+ /// Note that this only works if none of the other wake methods are called, as those also set
150
+ /// the timeout.
151
+ fn add_timeout ( & mut self , timeout : impl Into < Timeout > ) ;
146
152
}
147
153
148
154
/// Implementation of ContextExt for the Rust [`Context`] type.
@@ -164,4 +170,9 @@ impl<'b> ContextExt for Context<'b> {
164
170
info. add_queue ( queue) ;
165
171
info. timeout = timeout. into ( ) ;
166
172
}
173
+
174
+ fn add_timeout ( & mut self , timeout : impl Into < Timeout > ) {
175
+ let info = unsafe { WakeInfo :: from_context ( self ) } ;
176
+ info. timeout = timeout. into ( ) ;
177
+ }
167
178
}
Original file line number Diff line number Diff line change @@ -464,6 +464,12 @@ impl Signal {
464
464
}
465
465
}
466
466
467
+ impl Default for Signal {
468
+ fn default ( ) -> Self {
469
+ Signal :: new ( ) . unwrap ( )
470
+ }
471
+ }
472
+
467
473
/// The Future for Signal::wait_async.
468
474
struct SignalWait < ' a > {
469
475
/// The signal we are waiting on.
You can’t perform that action at this time.
0 commit comments