diff options
author | andrew-elder <aelder@audioscience.com> | 2018-05-17 15:26:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-17 15:26:34 -0400 |
commit | 9b96ee647da61ffdf06dad031d06b8b13228e697 (patch) | |
tree | 132b8a232973542bc16099e99fe467a52b540f8c | |
parent | 81783f1b0ac07b79aa337f0d137ea06046ffe579 (diff) | |
parent | 1cb01252c0b64b572c9d567a7c3a145d364dd12b (diff) | |
download | Open-AVB-9b96ee647da61ffdf06dad031d06b8b13228e697.tar.gz |
Merge pull request #779 from freddeng/freddeng-patch-1
Fix the dead lock when handling SYNC_RECEIPT_TIMEOUT_EXPIRES event
-rw-r--r-- | daemons/gptp/common/avbts_clock.hpp | 6 | ||||
-rw-r--r-- | daemons/gptp/common/common_port.cpp | 10 |
2 files changed, 11 insertions, 5 deletions
diff --git a/daemons/gptp/common/avbts_clock.hpp b/daemons/gptp/common/avbts_clock.hpp index 614464c2..22a72464 100644 --- a/daemons/gptp/common/avbts_clock.hpp +++ b/daemons/gptp/common/avbts_clock.hpp @@ -162,7 +162,9 @@ private: OSLock *timerq_lock; - /** +public: + + /** * @brief Add a new event to the timer queue * @param target EtherPort target * @param e Event to be added @@ -179,7 +181,7 @@ private: * @return void */ void deleteEventTimer( CommonPort *target, Event e ); -public: + /** * @brief Instantiates a IEEE 1588 Clock * @param forceOrdinarySlave Forces it to be an ordinary slave diff --git a/daemons/gptp/common/common_port.cpp b/daemons/gptp/common/common_port.cpp index 268bc62d..dc47d9d2 100644 --- a/daemons/gptp/common/common_port.cpp +++ b/daemons/gptp/common/common_port.cpp @@ -296,18 +296,22 @@ bool CommonPort::restoreSerializedState void CommonPort::startSyncReceiptTimer ( long long unsigned int waitTime ) { + clock->getTimerQLock(); syncReceiptTimerLock->lock(); - clock->deleteEventTimerLocked( this, SYNC_RECEIPT_TIMEOUT_EXPIRES ); - clock->addEventTimerLocked + clock->deleteEventTimer( this, SYNC_RECEIPT_TIMEOUT_EXPIRES ); + clock->addEventTimer ( this, SYNC_RECEIPT_TIMEOUT_EXPIRES, waitTime ); syncReceiptTimerLock->unlock(); + clock->putTimerQLock(); } void CommonPort::stopSyncReceiptTimer( void ) { + clock->getTimerQLock(); syncReceiptTimerLock->lock(); - clock->deleteEventTimerLocked( this, SYNC_RECEIPT_TIMEOUT_EXPIRES ); + clock->deleteEventTimer( this, SYNC_RECEIPT_TIMEOUT_EXPIRES ); syncReceiptTimerLock->unlock(); + clock->putTimerQLock(); } void CommonPort::startSyncIntervalTimer |