diff options
Diffstat (limited to 'daemons/gptp/common')
-rw-r--r-- | daemons/gptp/common/avbts_osthread.hpp | 2 | ||||
-rw-r--r-- | daemons/gptp/common/common_port.cpp | 8 | ||||
-rw-r--r-- | daemons/gptp/common/common_port.hpp | 8 | ||||
-rw-r--r-- | daemons/gptp/common/ether_port.cpp | 9 |
4 files changed, 12 insertions, 15 deletions
diff --git a/daemons/gptp/common/avbts_osthread.hpp b/daemons/gptp/common/avbts_osthread.hpp index e1fa7797..ba0c2a8b 100644 --- a/daemons/gptp/common/avbts_osthread.hpp +++ b/daemons/gptp/common/avbts_osthread.hpp @@ -87,7 +87,7 @@ public: virtual OSThread * createThread() const = 0; #ifdef RPI - virtual std::shared_ptr<OSThread> create() = 0; + virtual std::shared_ptr<OSThread> create() const = 0; #endif /** diff --git a/daemons/gptp/common/common_port.cpp b/daemons/gptp/common/common_port.cpp index 659d0d6a..3f2483e3 100644 --- a/daemons/gptp/common/common_port.cpp +++ b/daemons/gptp/common/common_port.cpp @@ -53,8 +53,10 @@ CommonPort::CommonPort( PortInit_t *portInit ) : one_way_delay = ONE_WAY_DELAY_DEFAULT; neighbor_prop_delay_thresh = portInit->neighborPropDelayThreshold; net_label = portInit->net_label; - link_thread = thread_factory->createThread(); - listening_thread = thread_factory->createThread(); +#ifndef RPI + link_thread = thread_factory->create(); +#endif + listening_thread = thread_factory->create(); sync_receipt_thresh = portInit->syncReceiptThreshold; wrongSeqIDCounter = 0; _peer_rate_offset = 1.0; @@ -80,8 +82,6 @@ CommonPort::CommonPort( PortInit_t *portInit ) : CommonPort::~CommonPort() { - delete link_thread; - delete listening_thread; delete syncReceiptTimerLock; delete syncIntervalTimerLock; delete announceIntervalTimerLock; diff --git a/daemons/gptp/common/common_port.hpp b/daemons/gptp/common/common_port.hpp index f4fc439e..64418829 100644 --- a/daemons/gptp/common/common_port.hpp +++ b/daemons/gptp/common/common_port.hpp @@ -451,10 +451,10 @@ protected: IEEE1588Clock * clock; const bool isGM; - OSThread *listening_thread; - OSThread *link_thread; - OSThread *eventThread; - OSThread *generalThread; + std::shared_ptr<OSThread> listening_thread; + std::shared_ptr<OSThread> link_thread; + std::shared_ptr<OSThread> eventThread; + std::shared_ptr<OSThread> generalThread; phy_delay_map_t const * const phy_delay; diff --git a/daemons/gptp/common/ether_port.cpp b/daemons/gptp/common/ether_port.cpp index 6b796b7c..d2763f4f 100644 --- a/daemons/gptp/common/ether_port.cpp +++ b/daemons/gptp/common/ether_port.cpp @@ -101,9 +101,6 @@ EtherPort::~EtherPort() delete port_ready_condition; #endif delete qualified_announce; - delete link_thread; - delete eventThread; - delete generalThread; delete pdelay_rx_lock; delete port_tx_lock; delete pDelayIntervalTimerLock; @@ -508,7 +505,7 @@ bool EtherPort::_processEvent( Event e ) #endif #ifdef RPI - link_thread = thread_factory->createThread(); + link_thread = thread_factory->create(); if(!link_thread->start(watchNetLinkWrapper, (void *)this)) { GPTP_LOG_ERROR("Error creating port link thread"); @@ -516,7 +513,7 @@ bool EtherPort::_processEvent( Event e ) } GPTP_LOG_VERBOSE("Starting event port thread"); - eventThread = thread_factory->createThread(); + eventThread = thread_factory->create(); if (!eventThread->start(openEventPortWrapper, (void *)this)) { GPTP_LOG_ERROR("Error creating event port thread"); @@ -524,7 +521,7 @@ bool EtherPort::_processEvent( Event e ) } GPTP_LOG_VERBOSE("Starting general port thread"); - generalThread = thread_factory->createThread(); + generalThread = thread_factory->create(); if (!generalThread->start(openGeneralPortWrapper, (void *)this)) { GPTP_LOG_ERROR("Error creating general port thread"); |