Skip to content

Commit

Permalink
Changed JobStack::take_once to use a &self.
Browse files Browse the repository at this point in the history
  • Loading branch information
dragostis committed Sep 14, 2024
1 parent 1d5e94f commit e8764ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl<F> JobStack<F> {
}

/// It should only be called once.
pub unsafe fn take_once(self) -> F {
pub unsafe fn take_once(&self) -> F {
// No `Job` has has been executed, therefore `self.f` has not yet been
// `take`n.
unsafe { ManuallyDrop::take(&mut *self.f.get()) }
Expand Down Expand Up @@ -144,9 +144,9 @@ impl<T> Job<T> {
{
// The `stack` is still alive.
let stack = unsafe { &*(stack as *const JobStack<F>) };
// This is the first call to `take` the closure since
// This is the first call to `take_once` the closure since
// `Job::execute` is called only after the job has been popped.
let f = unsafe { ManuallyDrop::take(&mut *stack.f.get()) };
let f = unsafe { stack.take_once() };
// Before being popped, the `JobQueue` allocates and store a
// `Future` in `self.fur_or_next` that should get passed here.
let fut = unsafe { &*(fut as *const Future<T>) };
Expand Down

0 comments on commit e8764ee

Please sign in to comment.