summaryrefslogtreecommitdiff
path: root/daemons/gptp/linux/src/linux_hal_common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'daemons/gptp/linux/src/linux_hal_common.cpp')
-rw-r--r--daemons/gptp/linux/src/linux_hal_common.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/daemons/gptp/linux/src/linux_hal_common.cpp b/daemons/gptp/linux/src/linux_hal_common.cpp
index 3be16c86..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;
}
@@ -528,9 +532,7 @@ bool LinuxTimerQueue::addEvent
its.it_value.tv_nsec = (micros % 1000000) * 1000;
err = timer_settime( outer_arg->timer_handle, 0, &its, NULL );
if( err < 0 ) {
- fprintf
- ( stderr, "Failed to arm timer: %s\n",
- strerror( errno ));
+ GPTP_LOG_ERROR("Failed to arm timer: %s", strerror(errno));
return false;
}
}