pub fn push(&self, data: &Arc<Node<T>>) -> Result<(), ()> {
        if data.enqueued.swap(true, SeqCst) {
            // note that even if our list is sealed off then the other end is
            // still guaranteed to see us because we were previously enqueued.
            return Ok(());
        }
        let mut head = self.list.load(SeqCst);
        let node = Arc::into_raw(data.clone()) as usize;
        loop {
            // If we've been sealed off, abort and return an error
            if head == 1 {
                unsafe {
                    drop(Arc::from_raw(node as *mut Node<T>));
                }
                return Err(());
            }

            // Otherwise attempt to push this node
            data.next.store(head, SeqCst);
            match self.list.compare_exchange(head, node, SeqCst, SeqCst) {
                Ok(_) => break Ok(()),
                Err(new_head) => head = new_head,
            }
        }
    }
/// Pushes the `data` provided onto this list if it's not already enqueued
/// in this list.
///
/// If `data` is already enqueued in this list then this is a noop,
/// otherwise, the `data` here is pushed on the end of the list.
Pushes the `data` provided onto this list if it's not already enqueued
in this list.

If `data` is already enqueued in this list then this is a noop,
otherwise, the `data` here is pushed on the end of the list.
Pushes the ` data ` provided onto this list if it ' s not already enqueued in this list . If ` data ` is already enqueued in this list then this is a noop otherwise the ` data ` here is pushed on the end of the list .
pub fn push(&self, data: &Arc<Node<T>>) -> Result<(), ()> {
        if data.enqueued.swap(true, SeqCst) {
            // note that even if our list is sealed off then the other end is
            // still guaranteed to see us because we were previously enqueued.
            return Ok(());
        }
        let mut head = self.list.load(SeqCst);
        let node = Arc::into_raw(data.clone()) as usize;
        loop {
            // If we've been sealed off, abort and return an error
            if head == 1 {
                unsafe {
                    drop(Arc::from_raw(node as *mut Node<T>));
                }
                return Err(());
            }
            // Otherwise attempt to push this node
            data.next.store(head, SeqCst);
            match self.list.compare_exchange(head, node, SeqCst, SeqCst) {
                Ok(_) => break Ok(()),
                Err(new_head) => head = new_head,
            }
        }
    }
pub fn push ( & self , data : & Arc < Node < T > > ) -> Result < ( ) , ( ) > { if data . enqueued . swap ( true , SeqCst ) { // note that even if our list is sealed off then the other end is // still guaranteed to see us because we were previously enqueued. return Ok ( ( ) ) ; } let mut head = self . list . load ( SeqCst ) ; let node = Arc :: into_raw ( data . clone ( ) ) as usize ; loop { // If we've been sealed off, abort and return an error if head == 1 { unsafe { drop ( Arc :: from_raw ( node as * mut Node < T > ) ) ; } return Err ( ( ) ) ; } // Otherwise attempt to push this node data . next . store ( head , SeqCst ) ; match self . list . compare_exchange ( head , node , SeqCst , SeqCst ) { Ok ( _ ) => break Ok ( ( ) ) , Err ( new_head ) => head = new_head , } } }
Pushes the `data` provided onto this list if it's not already enqueued
in this list.
Pushes the ` data ` provided onto this list if it ' s not already enqueued in this list .
&self
data
&Arc<Node<T>>
&self
data
&Arc<Node<T>>