Skip to content

Commit bc60941

Browse files
Add safety comments
1 parent 33128d9 commit bc60941

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

oneapi-rs/src/event.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ impl Future for EventFuture {
5757
*this.set_callback = true;
5858
let mut queue = Queue::new_immediate();
5959
this.shared.waker.register(cx.waker());
60+
// Safety: the SharedWaker will always outlive the C++ host task.
61+
// Safety: the Future which holds the SharedWaker is pinned - the pointer will remain valid.
6062
unsafe { ffi::register_callback(&mut queue.0, &this.event.0, this.shared) };
6163
this.queue.replace(queue);
6264
}
@@ -66,7 +68,6 @@ impl Future for EventFuture {
6668
return Poll::Ready(());
6769
}
6870

69-
// Register the waker if result isn't ready. This is a slow atomic operation
7071
this.shared.waker.register(cx.waker());
7172
}
7273

0 commit comments

Comments
 (0)