Chris Suter would like Owners Override to review this change.
[fuchsia-async] Make detaching tasks zero-cost
Instead of using RemoteHandle which carries some overhead, track join
results and cancellation within the executor. In this CL, there is only
a cost when a task has finished, or when the join handle has been
polled.
Also migrate from pin_utils::pin_mut to std::pin::pin.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
Owners-Override | +1 |
I only looked at the the files that did not already have +2
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
21 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: src/lib/fuchsia-async/src/runtime/fuchsia/task.rs
Insertions: 1, Deletions: 0.
@@ -123,6 +123,7 @@
impl<T> Drop for Task<T> {
fn drop(&mut self) {
if self.task_id != 0 {
+ // SAFETY: We spawned the task so the return type should be correct.
unsafe { self.executor.cancel::<T>(self.task_id) };
}
}
```
```
The name of the file: src/lib/fuchsia-async/src/runtime/fuchsia/executor/local.rs
Insertions: 3, Deletions: 1.
@@ -66,6 +66,8 @@
);
let Poll::Ready(result) = self.run::</* UNTIL_STALLED: */ false, F::Output>(
+ // SAFETY: This is a singlethreaded executor, so the future will never be sent across
+ // threads.
unsafe { AtomicFuture::new_local(main_future, true) }
) else {
unreachable!()
@@ -195,7 +197,7 @@
loop {
let result = self.local.run::</* UNTIL_STALLED: */ true, F::Output>(
- // SAFETY: We meet the Send requirements.
+ // SAFETY: We don't move the main future across threads.
unsafe { AtomicFuture::new_local(main_future.as_mut(), true) }
);
if result.is_ready() {
```
[fuchsia-async] Make detaching tasks zero-cost
Instead of using RemoteHandle which carries some overhead, track join
results and cancellation within the executor. In this CL, there is only
a cost when a task has finished, or when the join handle has been
polled.
Also migrate from pin_utils::pin_mut to std::pin::pin.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
Change has been successfully rolled: http://go/roll-cl/9e790fe90bff9f7716a4496f957fc16d379db2b4
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |