Skip to content

Commit d3147d7

Browse files
author
Mikołaj Małecki
committed
Added atomic to additional fields reported by sanitizer
1 parent 9039b3c commit d3147d7

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

srtcore/core.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ class CUDT
860860
int32_t m_iRcvLastSkipAck; // Last dropped sequence ACK
861861
int32_t m_iRcvLastAckAck; // Last sent ACK that has been acknowledged
862862
int32_t m_iAckSeqNo; // Last ACK sequence number
863-
int32_t m_iRcvCurrSeqNo; // Largest received sequence number
863+
srt::sync::atomic<int32_t> m_iRcvCurrSeqNo; // Largest received sequence number
864864
int32_t m_iRcvCurrPhySeqNo; // Same as m_iRcvCurrSeqNo, but physical only (disregarding a filter)
865865

866866
int32_t m_iPeerISN; // Initial Sequence Number of the peer side

srtcore/group.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ class CUDTGroup
449449
bool m_bSyncOnMsgNo;
450450
SRT_GROUP_TYPE m_type;
451451
CUDTSocket* m_listener; // A "group" can only have one listener.
452-
int m_iBusy;
452+
srt::sync::atomic<int> m_iBusy;
453453
CallbackHolder<srt_connect_callback_fn> m_cbConnectHook;
454454
void installConnectHook(srt_connect_callback_fn* hook, void* opaq)
455455
{

srtcore/queue.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -242,15 +242,17 @@ void CUnitQueue::makeUnitFree(CUnit *unit)
242242
SRT_ASSERT(unit != NULL);
243243
SRT_ASSERT(unit->m_iFlag != CUnit::FREE);
244244
unit->m_iFlag = CUnit::FREE;
245+
245246
--m_iCount;
246247
}
247248

248249
void CUnitQueue::makeUnitGood(CUnit *unit)
249250
{
251+
++m_iCount;
252+
250253
SRT_ASSERT(unit != NULL);
251254
SRT_ASSERT(unit->m_iFlag == CUnit::FREE);
252255
unit->m_iFlag = CUnit::GOOD;
253-
++m_iCount;
254256
}
255257

256258
CSndUList::CSndUList()

srtcore/queue.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class CUnitQueue
136136
CUnit* m_pAvailUnit; // recent available unit
137137

138138
int m_iSize; // total size of the unit queue, in number of packets
139-
int m_iCount; // total number of valid (occupied) packets in the queue
139+
srt::sync::atomic<int> m_iCount; // total number of valid (occupied) packets in the queue
140140

141141
int m_iMSS; // unit buffer size
142142
int m_iIPversion; // IP version

0 commit comments

Comments
 (0)