< Previous by Date | Date Index | Next by Date > |
Thread Index | Next in Thread > |
Hi. All While running repro I go an assert error from the AbstractFifo::getNext
method: void* AbstractFifo::getNext() { Lock
lock(mMutex); (void)lock; while (mFifo.empty()) {
mCondition.wait(mMutex); } void* firstMessage =
mFifo.front();
mFifo.pop_front(); assert(mSize !=
0); mSize--; return firstMessage; } As I see it the problem is
caused probably because non thread safe adding of elements to the Fifo. Meaning
mSize++ is missing somewhere and from what I investigated the only reason for using
mSize instead of using std::deque::size is because we want to make sure that
mSize < mMaxSize. Is there another reason? Is it ok to replace the
lines: assert(mSize !=
0); mSize--; with mSize = mFifo.size(); Is it ok to replace the line: while (mFifo.empty()) with while (mSize==0) //this.empty() Any other solution? |