MCPcopy Create free account
hub / github.com/NthTensor/Forte / wake_by_ref

Method wake_by_ref

src/scope.rs:883–897  ·  view source on GitHub ↗

Queues self to be executed without consuming the waker. # Safety Must be called with a pointer created by calling `Arc::into_raw` on an instance of `Arc ` that is still alive.

(this: *const ())

Source from the content-addressed store, hash-verified

881 // SAFETY: The LOCKED state gives us exclusive access. Dropping
882 // a `!Send` future here is sound because `poll` only runs where
883 // the scheduler enqueues it, and `spawn_local` (the only entry
884 // for `!Send` work) confines every (re)schedule to the origin
885 // worker's thread, so this drop happens on that thread.
886 unsafe { ManuallyDrop::drop(&mut *this.future.get()) };
887 drop(this);
888 }
889 // The job is still pending, and has not yet panicked.
890 Ok(Poll::Pending) => {
891 // Try to set the state back to `READY` so other threads can
892 // schedule it again. This will only fail if the job was woken
893 // while running, and is already in the WOKEN state.
894 //
895 // On success this publishes the poll's writes with `Release`; a
896 // later poll's opening `Acquire` swap synchronizes with it (see
897 // the SAFETY comment above), ordering this poll before the next.
898 let rescheduled = this
899 .state
900 .compare_exchange(

Callers 1

pollMethod · 0.45

Calls 1

scheduleMethod · 0.45

Tested by

no test coverage detected