Return TypeFunction nameArguments
voidhzChain::Clear(void)

Declared in file: hzChain.h
Defined in file : hzChain.cpp

Function Logic:

0:START 1:!mx 2: No text 3:cx mx 4:cx->m_Test!=cx 5:hzexit 6:cx->m_copy<=0 7:hzexit 8:_hzGlobal_MT 9:__sync_add_and_fetch 10:cx->m_copy 11: No text 12:items 13:cx->m_copy 14: No text 15:cx->m_Begin 16:hzLockRWD::LockWrite 17:!cx->m_End 18:hzexit ( zp 19:zp; 20:_zblk::Next np zp items 21:hzLockRWD::Unlock 22:cx 23: No text

Function body:

void hzChain::Clear (void)
{
   _hzfunc("hzChain::Clear") ;
   _chain*     cx ;
   _zblk*      zp ;
   _zblk*      np ;
   if (!mx)
       return ;
   cx = mx ;
   mx = 0;
   if (cx->m_Test != cx)
       hzexit(E_CORRUPT, "Chain is not self addressing") ;
   if (cx->m_copy <&eq; 0)
       hzexit(E_CORRUPT, "Copy count must be at least 1 in live chain") ;
    if (_hzGlobal_MT)
    {
        __sync_add_and_fetch(&(cx->m_copy), -1);
        if (cx->m_copy)
           return ;
    }
    else
    {
        cx->m_copy-- ;
        if (cx->m_copy)
           return ;
    }
   if (cx->m_Begin)
   {
       s_chain_mutex.LockWrite() ;
           if (!cx->m_End)
               hzexit(E_CORRUPT, "No end block") ;
           for (zp = (_zblk*) cx->m_Begin ; zp ; zp = np)
           {
               np = zp->Next() ;
               delete zp ;
               _hzGlobal_Memstats.m_numChainBlks-- ;
           }
       s_chain_mutex.Unlock() ;
   }
   delete cx ;
}