Example #1
0
purgeinfo_t *ShmPrivatePurgeData::findTagInfo(int idTag)
{
    shm_purgedata_t *pData = NULL;
    shm_privpurgedata_t *pList =
        (shm_privpurgedata_t *)m_pool->offset2ptr(m_shmoff);
    lock();
    LsShmOffset_t offData = pList->x_listhead;
    while (offData != 0)
    {
        pData = (shm_purgedata_t *)m_pool->offset2ptr(offData);
        if (pData->x_purgeinfo.idTag == idTag)
        {
//             LOG4CXX_NS::Logger::getRootLogger()->debug(
//                     "tag: %d, entry timestamp: %d.%d, purge timestamp: %d.%d, flag, %d",
//                     idTag, sec, (int)msec, pData->x_purgeinfo.tmSecs,
//                     pData->x_purgeinfo.tmMsec, pData->x_purgeinfo.flags );

            unlock();
            return &pData->x_purgeinfo;
        }
        offData = pData->x_offNext;
    }
    unlock();
    return NULL;
}
Example #2
0
LsShmOffset_t ShmPrivatePurgeData::addUpdate(purgeinfo_t *pInfo)
{
    shm_purgedata_t *pData;
    shm_privpurgedata_t *pList =
        (shm_privpurgedata_t *)m_pool->offset2ptr(m_shmoff);

    lock();

    pList->x_tmLastUpdate = DateTime::s_curTime;

    LsShmOffset_t offData = pList->x_listhead;
    while (offData != 0)
    {
        pData = (shm_purgedata_t *)m_pool->offset2ptr(offData);
        if (pData->x_purgeinfo.idTag == pInfo->idTag)
            break;
        offData = pData->x_offNext;
    }
    if (offData == 0)
    {
        int remapped = 0;
        offData = m_pool->alloc2(sizeof(shm_purgedata_t), remapped);
        if (remapped)
            pList = (shm_privpurgedata_t *)m_pool->offset2ptr(m_shmoff);

        if (offData != 0)
        {
            pData = (shm_purgedata_t *)m_pool->offset2ptr(offData);
            pData->x_offNext = pList->x_listhead;
            pList->x_listhead = offData;
        }
        else
        {
            unlock();
            return 0;
        }
    }
    memmove(&pData->x_purgeinfo, pInfo, sizeof(*pInfo));

    unlock();

    return offData;
}
Example #3
0
void ShmPrivatePurgeData::unlock()
{
    shm_privpurgedata_t *pList =
        (shm_privpurgedata_t *)m_pool->offset2ptr(m_shmoff);
    ls_spinlock_unlock(&pList->x_lock);
}