Merge pull request #2351 from jolavillette/free_pendMutexFix

add missing mutex locks around free_pend() calls in 3 places in pqistreamer.cc
This commit is contained in:
csoler 2021-02-24 10:10:09 +01:00 committed by GitHub
commit 2cdad9ea66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -304,17 +304,13 @@ int pqistreamer::tick_bio()
int pqistreamer::tick_recv(uint32_t timeout)
{
// Apart from a few exceptions that are atomic (mLastIncomingTs, mIncomingSize), only this pqi thread reads/writes mIncoming queue and related counters.
// The lock of pqistreamer mutex is thus not needed here.
// The mutex lock is still needed before calling locked_addTrafficClue because this method is also used by the thread pushing packets in mOutPkts.
// Locks around rates are provided internally.
if (mBio->moretoread(timeout))
{
handleincoming();
}
if(!(mBio->isactive()))
{
RsStackMutex stack(mStreamerMtx);
free_pend();
}
return 1;
@ -325,6 +321,7 @@ int pqistreamer::tick_send(uint32_t timeout)
/* short circuit everything if bio isn't active */
if (!(mBio->isactive()))
{
RsStackMutex stack(mStreamerMtx);
free_pend();
return 0;
}
@ -720,6 +717,7 @@ int pqistreamer::handleincoming()
if(!(mBio->isactive()))
{
RsStackMutex stack(mStreamerMtx);
mReading_state = reading_state_initial ;
free_pend();
return 0;