pub(super) fn push_back(&mut self, mut task: task::Notified<T>, inject: &Inject<T>) {
        let tail = loop {
            let head = self.inner.head.load(Acquire);
            let (steal, real) = unpack(head);

            // safety: this is the **only** thread that updates this cell.
            let tail = unsafe { self.inner.tail.unsync_load() };

            if tail.wrapping_sub(steal) < LOCAL_QUEUE_CAPACITY as u16 {
                // There is capacity for the task
                break tail;
            } else if steal != real {
                // Concurrently stealing, this will free up capacity, so
                // only push the new task onto the inject queue
                inject.push(task);
                return;
            } else {
                // Push the current task and half of the queue into the
                // inject queue.
                match self.push_overflow(task, real, tail, inject) {
                    Ok(_) => return,
                    // Lost the race, try again
                    Err(v) => {
                        task = v;
                    }
                }
            }
        };

        // Map the position to a slot index.
        let idx = tail as usize & MASK;

        self.inner.buffer[idx].with_mut(|ptr| {
            // Write the task to the slot
            //
            // Safety: There is only one producer and the above `if`
            // condition ensures we don't touch a cell if there is a
            // value, thus no consumer.
            unsafe {
                ptr::write((*ptr).as_mut_ptr(), task);
            }
        });

        // Make the task available. Synchronizes with a load in
        // `steal_into2`.
        self.inner.tail.store(tail.wrapping_add(1), Release);
    }
/// Pushes a task to the back of the local queue, skipping the LIFO slot.
Pushes a task to the back of the local queue, skipping the LIFO slot.
Pushes a task to the back of the local queue skipping the LIFO slot .
pub(super) fn push_back(&mut self, mut task: task::Notified<T>, inject: &Inject<T>) {
        let tail = loop {
            let head = self.inner.head.load(Acquire);
            let (steal, real) = unpack(head);
            // safety: this is the **only** thread that updates this cell.
            let tail = unsafe { self.inner.tail.unsync_load() };
            if tail.wrapping_sub(steal) < LOCAL_QUEUE_CAPACITY as u16 {
                // There is capacity for the task
                break tail;
            } else if steal != real {
                // Concurrently stealing, this will free up capacity, so
                // only push the new task onto the inject queue
                inject.push(task);
                return;
            } else {
                // Push the current task and half of the queue into the
                // inject queue.
                match self.push_overflow(task, real, tail, inject) {
                    Ok(_) => return,
                    // Lost the race, try again
                    Err(v) => {
                        task = v;
                    }
                }
            }
        };
        // Map the position to a slot index.
        let idx = tail as usize & MASK;
        self.inner.buffer[idx].with_mut(|ptr| {
            // Write the task to the slot
            //
            // Safety: There is only one producer and the above `if`
            // condition ensures we don't touch a cell if there is a
            // value, thus no consumer.
            unsafe {
                ptr::write((*ptr).as_mut_ptr(), task);
            }
        });
        // Make the task available. Synchronizes with a load in
        // `steal_into2`.
        self.inner.tail.store(tail.wrapping_add(1), Release);
    }
pub ( super ) fn push_back ( & mut self , mut task : task :: Notified < T > , inject : & Inject < T > ) { let tail = loop { let head = self . inner . head . load ( Acquire ) ; let ( steal , real ) = unpack ( head ) ; // safety: this is the **only** thread that updates this cell. let tail = unsafe { self . inner . tail . unsync_load ( ) } ; if tail . wrapping_sub ( steal ) < LOCAL_QUEUE_CAPACITY as u16 { // There is capacity for the task break tail ; } else if steal != real { // Concurrently stealing, this will free up capacity, so // only push the new task onto the inject queue inject . push ( task ) ; return ; } else { // Push the current task and half of the queue into the // inject queue. match self . push_overflow ( task , real , tail , inject ) { Ok ( _ ) => return , // Lost the race, try again Err ( v ) => { task = v ; } } } } ; // Map the position to a slot index. let idx = tail as usize & MASK ; self . inner . buffer [ idx ] . with_mut ( | ptr | { // Write the task to the slot // // Safety: There is only one producer and the above `if` // condition ensures we don't touch a cell if there is a // value, thus no consumer. unsafe { ptr :: write ( ( * ptr ) . as_mut_ptr ( ) , task ) ; } } ) ; // Make the task available. Synchronizes with a load in // `steal_into2`. self . inner . tail . store ( tail . wrapping_add ( 1 ) , Release ) ; }
Pushes a task to the back of the local queue, skipping the LIFO slot.
Pushes a task to the back of the local queue skipping the LIFO slot .
&mut self
task
task::Notified<T>
inject
&Inject<T>
&mut self
task
task::Notified<T>
inject
&Inject<T>