I have this code like this:
uint16_t getNextAvailableTransactionID() throw (RMAPEngineException) {
transactionIDMutex.lock();
if (availableTransactionIDList.size() != 0) {
unsigned int tid = *(availableTransactionIDList.begin());
availableTransactionIDList.pop_front();
transactionIDMutex.unlock();
return tid;
} else {
transactionIDMutex.unlock();
throw RMAPEngineException(RMAPEngineException::TooManyConcurrentTransactions);
}
}
and the availableTransactionIDList is a std::list of C++
Because I use this function as a part in reading out data from hardware. After checking, the overhead coming from the the availableTransactionIDList (I used a clock_gettime() and make a timestamp in the functions to check).
Just wondering, is there anyway to solve the problem with overhead of std::list ?