unsafe fn prepare_drop(&self, config: PoolConfig) -> Result<(), Error> {
        if !self.is_shared() {
            // If there are zero references, we should be able to guarantee that
            // nothing else will change the region anymore.
            //
            // We need to clear our next pointers and remove their references.
            // This won't cause a problem for readers, as there aren't any other
            // references to this node. Even if we end up not destroying the
            // region, we would have to do this anyway when re-inserting it, so
            // we might as well.
            for which in [ListSel::Free, ListSel::All] {
                let next = self.next(which).load(Relaxed);

                if let Some(next_p) = ptr::NonNull::new(next) {
                    next_p.as_ref().decr_ref();
                    self.next(which).store(ptr::null_mut(), Relaxed);
                }
            }

            // Check to make sure the region is actually empty.
            if self.bitmap(config).is_empty() {
                // If so, it's definitely safe to drop this region.
                Ok(())
            } else {
                Err(Error::RegionNotEmpty(self.region_base(config)))
            }
        } else {
            Err(Error::RegionInUse(self.region_base(config)))
        }
    }
/// Prepares the region for destruction. Returns `Ok` if the region is safe
/// to release, `Err` otherwise.
///
/// If [Error::RegionInUse] is returned, this may be a temporary condition;
/// a short loop might be called for to have a higher chance of being able
/// to remove the region.
///
/// # Unsafety
///
/// Calls [bitmap], so the same caveats apply.
Prepares the region for destruction. Returns `Ok` if the region is safe
to release, `Err` otherwise.

If [Error::RegionInUse] is returned, this may be a temporary condition;
a short loop might be called for to have a higher chance of being able
to remove the region.
Prepares the region for destruction . Returns ` Ok ` if the region is safe to release ` Err ` otherwise . If [ Error :: RegionInUse ] is returned this may be a temporary condition ; a short loop might be called for to have a higher chance of being able to remove the region .
unsafe fn prepare_drop(&self, config: PoolConfig) -> Result<(), Error> {
        if !self.is_shared() {
            // If there are zero references, we should be able to guarantee that
            // nothing else will change the region anymore.
            //
            // We need to clear our next pointers and remove their references.
            // This won't cause a problem for readers, as there aren't any other
            // references to this node. Even if we end up not destroying the
            // region, we would have to do this anyway when re-inserting it, so
            // we might as well.
            for which in [ListSel::Free, ListSel::All] {
                let next = self.next(which).load(Relaxed);
                if let Some(next_p) = ptr::NonNull::new(next) {
                    next_p.as_ref().decr_ref();
                    self.next(which).store(ptr::null_mut(), Relaxed);
                }
            }
            // Check to make sure the region is actually empty.
            if self.bitmap(config).is_empty() {
                // If so, it's definitely safe to drop this region.
                Ok(())
            } else {
                Err(Error::RegionNotEmpty(self.region_base(config)))
            }
        } else {
            Err(Error::RegionInUse(self.region_base(config)))
        }
    }
unsafe fn prepare_drop ( & self , config : PoolConfig ) -> Result < ( ) , Error > { if ! self . is_shared ( ) { // If there are zero references, we should be able to guarantee that // nothing else will change the region anymore. // // We need to clear our next pointers and remove their references. // This won't cause a problem for readers, as there aren't any other // references to this node. Even if we end up not destroying the // region, we would have to do this anyway when re-inserting it, so // we might as well. for which in [ ListSel :: Free , ListSel :: All ] { let next = self . next ( which ) . load ( Relaxed ) ; if let Some ( next_p ) = ptr :: NonNull :: new ( next ) { next_p . as_ref ( ) . decr_ref ( ) ; self . next ( which ) . store ( ptr :: null_mut ( ) , Relaxed ) ; } } // Check to make sure the region is actually empty. if self . bitmap ( config ) . is_empty ( ) { // If so, it's definitely safe to drop this region. Ok ( ( ) ) } else { Err ( Error :: RegionNotEmpty ( self . region_base ( config ) ) ) } } else { Err ( Error :: RegionInUse ( self . region_base ( config ) ) ) } }
Prepares the region for destruction.
Prepares the region for destruction .
&self
config
PoolConfig
unsafety
Calls [bitmap], so the same caveats apply.
Calls [ bitmap ] so the same caveats apply .