[reSIProcate] AbstractFifo bug?
Micky Kaufmann
micky at proxy.co.il
Thu May 19 08:31:12 CDT 2005
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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20050519/97c30a24/attachment.htm>
More information about the resiprocate-devel
mailing list