diff options
-rw-r--r-- | daemons/gptp/common/ether_port.cpp | 8 | ||||
-rw-r--r-- | daemons/gptp/linux/src/linux_hal_common.cpp | 20 |
2 files changed, 13 insertions, 15 deletions
diff --git a/daemons/gptp/common/ether_port.cpp b/daemons/gptp/common/ether_port.cpp index e576705c..56db3d22 100644 --- a/daemons/gptp/common/ether_port.cpp +++ b/daemons/gptp/common/ether_port.cpp @@ -174,14 +174,8 @@ void EtherPort::startPDelay() if( getPDelayInterval() != PTPMessageSignalling::sigMsgInterval_NoSend) { - long long unsigned int waitTime; - waitTime = ((long long) - (pow((double)2, - getPDelayInterval()) * - 1000000000.0)); - waitTime = waitTime > EVENT_TIMER_GRANULARITY ? waitTime : EVENT_TIMER_GRANULARITY; pdelay_started = true; - startPDelayIntervalTimer(waitTime); + startPDelayIntervalTimer(EVENT_TIMER_GRANULARITY); } } else { diff --git a/daemons/gptp/linux/src/linux_hal_common.cpp b/daemons/gptp/linux/src/linux_hal_common.cpp index 77bf664f..ab312c95 100644 --- a/daemons/gptp/linux/src/linux_hal_common.cpp +++ b/daemons/gptp/linux/src/linux_hal_common.cpp @@ -428,14 +428,19 @@ void *LinuxTimerQueueHandler( void *arg ) { timeout.tv_sec = 0; timeout.tv_nsec = 100000000; /* 100 ms */ sigemptyset( &waitfor ); - + GPTP_LOG_DEBUG("Signal thread started"); while( !timerq->stop ) { siginfo_t info; LinuxTimerQueueMap_t::iterator iter; sigaddset( &waitfor, SIGUSR1 ); if( sigtimedwait( &waitfor, &info, &timeout ) == -1 ) { - if( errno == EAGAIN ) continue; - else break; + if( errno == EAGAIN ) { + continue; + } + else { + GPTP_LOG_ERROR("Signal thread sigtimedwait error: %d", errno); + break; + } } if( timerq->lock->lock() != oslock_ok ) { break; @@ -456,7 +461,7 @@ void *LinuxTimerQueueHandler( void *arg ) { break; } } - + GPTP_LOG_DEBUG("Signal thread exit"); return NULL; } @@ -474,6 +479,9 @@ OSTimerQueue *LinuxTimerQueueFactory::createOSTimerQueue return NULL; } + ret->key = 0; + ret->stop = false; + ret->lock = clock->timerQLock(); if( pthread_create ( &(ret->_private->signal_thread), NULL, LinuxTimerQueueHandler, ret ) != 0 ) { @@ -481,10 +489,6 @@ OSTimerQueue *LinuxTimerQueueFactory::createOSTimerQueue return NULL; } - ret->stop = false; - ret->key = 0; - ret->lock = clock->timerQLock(); - return ret; } |