File tree 2 files changed +24
-1
lines changed
uefi-test-runner/src/boot
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -46,8 +46,12 @@ fn test_check_event_freestanding() {
46
46
let event =
47
47
unsafe { boot:: create_event ( EventType :: NOTIFY_WAIT , Tpl :: CALLBACK , Some ( callback) , None ) }
48
48
. unwrap ( ) ;
49
- let is_signaled = boot:: check_event ( event) . unwrap ( ) ;
49
+
50
+ let event_clone = unsafe { event. unsafe_clone ( ) } ;
51
+ let is_signaled = boot:: check_event ( event_clone) . unwrap ( ) ;
50
52
assert ! ( !is_signaled) ;
53
+
54
+ boot:: close_event ( event) . unwrap ( ) ;
51
55
}
52
56
53
57
fn test_timer_freestanding ( ) {
@@ -56,6 +60,8 @@ fn test_timer_freestanding() {
56
60
let mut events = unsafe { [ timer_event. unsafe_clone ( ) ] } ;
57
61
boot:: set_timer ( & timer_event, TimerTrigger :: Relative ( 5_0 /*00 ns */ ) ) . unwrap ( ) ;
58
62
assert_eq ! ( boot:: wait_for_event( & mut events) . unwrap( ) , 0 ) ;
63
+
64
+ boot:: close_event ( timer_event) . unwrap ( ) ;
59
65
}
60
66
61
67
fn test_timer ( bt : & BootServices ) {
Original file line number Diff line number Diff line change @@ -234,6 +234,23 @@ pub fn check_event(event: Event) -> Result<bool> {
234
234
}
235
235
}
236
236
237
+ /// Removes `event` from any event group to which it belongs and closes it.
238
+ ///
239
+ /// If `event` was registered with `register_protocol_notify`, then the
240
+ /// corresponding registration will be removed. Calling this function within the
241
+ /// corresponding notify function is allowed.
242
+ ///
243
+ /// # Errors
244
+ ///
245
+ /// The specification does not list any errors, however implementations are
246
+ /// allowed to return an error if needed.
247
+ pub fn close_event ( event : Event ) -> Result {
248
+ let bt = boot_services_raw_panicking ( ) ;
249
+ let bt = unsafe { bt. as_ref ( ) } ;
250
+
251
+ unsafe { ( bt. close_event ) ( event. as_ptr ( ) ) } . to_result ( )
252
+ }
253
+
237
254
/// Sets the trigger for an event of type [`TIMER`].
238
255
///
239
256
/// # Errors
You can’t perform that action at this time.
0 commit comments