unsafe fn steal(&self) -> Option<JobRef> {
        // we only steal when we don't have any work to do locally
        debug_assert!(self.local_deque_is_empty());

        // otherwise, try to steal
        let num_threads = self.registry.thread_infos.len();
        if num_threads <= 1 {
            return None;
        }

        let start = self.rng.next_usize(num_threads);
        (start..num_threads)
            .chain(0..start)
            .filter(|&i| i != self.index)
            .filter_map(|victim_index| {
                let victim = &self.registry.thread_infos[victim_index];
                loop {
                    match victim.stealer.steal() {
                        Steal::Empty => return None,
                        Steal::Success(d) => {
                            log!(StoleWork {
                                worker: self.index,
                                victim: victim_index
                            });
                            return Some(d);
                        }
                        Steal::Retry => {}
                    }
                }
            })
            .next()
    }
/// Try to steal a single job and return it.
///
/// This should only be done as a last resort, when there is no
/// local work to do.
Try to steal a single job and return it.
This should only be done as a last resort, when there is no
local work to do.
Try to steal a single job and return it . This should only be done as a last resort when there is no local work to do .
unsafe fn steal(&self) -> Option<JobRef> {
        // we only steal when we don't have any work to do locally
        debug_assert!(self.local_deque_is_empty());
        // otherwise, try to steal
        let num_threads = self.registry.thread_infos.len();
        if num_threads <= 1 {
            return None;
        }
        let start = self.rng.next_usize(num_threads);
        (start..num_threads)
            .chain(0..start)
            .filter(|&i| i != self.index)
            .filter_map(|victim_index| {
                let victim = &self.registry.thread_infos[victim_index];
                loop {
                    match victim.stealer.steal() {
                        Steal::Empty => return None,
                        Steal::Success(d) => {
                            log!(StoleWork {
                                worker: self.index,
                                victim: victim_index
                            });
                            return Some(d);
                        }
                        Steal::Retry => {}
                    }
                }
            })
            .next()
    }
unsafe fn steal ( & self ) -> Option < JobRef > { // we only steal when we don't have any work to do locally debug_assert ! ( self local_deque_is_empty ( ) ) ; // otherwise, try to steal let num_threads = self . registry . thread_infos . len ( ) ; if num_threads <= 1 { return None ; } let start = self . rng . next_usize ( num_threads ) ; ( start .. num_threads ) . chain ( 0 .. start ) . filter ( | & i | i != self . index ) . filter_map ( | victim_index | { let victim = & self . registry . thread_infos [ victim_index ] ; loop { match victim . stealer . steal ( ) { Steal :: Empty => return None , Steal :: Success ( d ) => { log ! ( StoleWork { worker self index victim victim_index } ) ; return Some ( d ) ; } Steal :: Retry => { } } } } ) . next ( ) }
Try to steal a single job and return it.
Try to steal a single job and return it .
&self