add missing mutex locks around free_pend calls in pqistreamer.cc

This commit is contained in:
jolavillette 2021-02-22 09:04:33 +01:00
parent e765aebf8a
commit b8b3d7515c

View File

@ -304,17 +304,13 @@ int pqistreamer::tick_bio()
int pqistreamer::tick_recv(uint32_t timeout) 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)) if (mBio->moretoread(timeout))
{ {
handleincoming(); handleincoming();
} }
if(!(mBio->isactive())) if(!(mBio->isactive()))
{ {
RsStackMutex stack(mStreamerMtx);
free_pend(); free_pend();
} }
return 1; return 1;
@ -325,6 +321,7 @@ int pqistreamer::tick_send(uint32_t timeout)
/* short circuit everything if bio isn't active */ /* short circuit everything if bio isn't active */
if (!(mBio->isactive())) if (!(mBio->isactive()))
{ {
RsStackMutex stack(mStreamerMtx);
free_pend(); free_pend();
return 0; return 0;
} }
@ -720,6 +717,7 @@ int pqistreamer::handleincoming()
if(!(mBio->isactive())) if(!(mBio->isactive()))
{ {
RsStackMutex stack(mStreamerMtx);
mReading_state = reading_state_initial ; mReading_state = reading_state_initial ;
free_pend(); free_pend();
return 0; return 0;