Пример #1
0
void SipTransactionList::deleteTransactionTimers()
{
#ifdef TIME_LOG
    Os::Logger::instance().log(FAC_SIP, PRI_DEBUG,
                               "SipTransactionList::deleteTransactionTimers entered");
#endif

    // It is possible that there are a very large number of transactions,
    // so we don't want to hold the lock while processing all of them.
    // So we make a list of the addresses of all the SipTransactions
    // and then process them afterward.

    lock();

    int numTransactions = mTransactions.entries();
    SipTransaction** transactionsToBeProcessed =
        new SipTransaction*[numTransactions];

    if (numTransactions > 0)
    {
        UtlHashBagIterator iterator(mTransactions);
        SipTransaction* transactionFound;
        int count = 0;

        while ((transactionFound = dynamic_cast <SipTransaction*> (iterator())))
        {
            transactionsToBeProcessed[count++] = transactionFound;
        }
    }

    unlock();

    // Now process each transaction in turn.
    for (int i = 0; i < numTransactions; i++)
    {
        lock();

        SipTransaction* transaction = transactionsToBeProcessed[i];
        // Verify (within a critical section) that this transaction is
        // still in mTransactions.
        if (mTransactions.findReference(transaction))
        {
            transaction->deleteTimers();
        }

        unlock();

        // Let any threads that are waiting for mListMutex run.
        OsTask::yield();
    }

    // Delete list of transactions.
    delete[] transactionsToBeProcessed;

#ifdef TIME_LOG
    Os::Logger::instance().log(FAC_SIP, PRI_DEBUG,
                               "SipTransactionList::deleteTransactionTimers exited %d entries",
                               numTransactions);
#endif
}
Пример #2
0
void SipTransactionList::deleteTransactionTimers()
{
    lock();

    int numTransactions = mTransactions.entries();
    if(numTransactions > 0)
    {
        UtlHashBagIterator iterator(mTransactions);
        SipTransaction* transactionFound = NULL;

        while((transactionFound = (SipTransaction*) iterator()))
        {
            transactionFound->deleteTimers();
        }
    }

    unlock();
}