srt
srt copied to clipboard
[core] Fixed cycle-deadlock on m_ConnectionLock and refax on locks in SndUList
Changes:
- Refactored locks in SndUList and SndQueue. Actually m_WindowLock was also locking resources for SndUList and "borrowing" them from SndQueue was a poor design. Instead SndQueue is given limited access to these locks and the locks are contained in the SndUList, which should clear the controversies for using two different locks for the same purpose.
- Also changed the lock form into CEvent as the lock serves also the purpose of locking around a CV.
- Added temporary unlocking of mutexes that would be locked in the wrong order.
- Removed the lock for CUDTSocket::m_ControlLock that breaks the ordering against m_ConnectionLock. This lock is likely not necessary provided that m_GlobControlLock is also applied.
Reviewing notes
-
CSndUList
- list (heap) ofCUDT
sockets to send data packets.-
m_ListLock
- locksCSndUList
modifications.update
,pop
,remove
,getNextProcTime
. -
m_pWindowLock
- pointer to mutex owned byCSndQueue
, only used together with the CV to signal there was a new entry added if it was empty. -
m_pWindowCond
- a pointer to a CV owned byCSndQueue
.
-
-
CSndQueue
- a class that ownsCSndUList
.-
m_WindowLock
-
m_WindowCond
- CV used to wait forCSndUList
to become non-empty. Also signalled in the destructor to unblock the worker thread.
-
Closed.
- One fix is provided different way
- The other is left in #1824.
- Another fix is proven not necessary and developer info about this is updated.