diff options
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c')
-rw-r--r-- | runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etLogger.c | 12 | ||||
-rw-r--r-- | runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etTimer.c | 13 |
2 files changed, 8 insertions, 17 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etLogger.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etLogger.c index 42fe4cd82..f4f5b38f2 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etLogger.c +++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etLogger.c @@ -18,8 +18,8 @@ void etLogger_logError(const char* message){ - fprintf(stderr, "ERROR: %s\n", message); - fflush(stderr); + fprintf(stdout, "ERROR: %s\n", message); + fflush(stdout); } void etLogger_logWarning(const char* message){ @@ -33,13 +33,13 @@ void etLogger_logInfo(const char* message){ } void etLogger_logErrorF(const char* format, ... ){ - fprintf(stderr, "ERROR: "); + fprintf(stdout, "ERROR: "); va_list arglist; va_start( arglist, format ); - vfprintf(stderr, format, arglist ); + vfprintf(stdout, format, arglist ); va_end( arglist ); - fprintf(stderr, "\n"); - fflush(stderr); + fprintf(stdout, "\n"); + fflush(stdout); } void etLogger_logWarningF(const char* format, ... ){ diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etTimer.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etTimer.c index 4072de8c6..09606b8b0 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etTimer.c +++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etTimer.c @@ -66,7 +66,6 @@ static void timerThreadFunction(void* data) { while (ET_TRUE) { etTimer* it; int idx; - int signaled = ET_FALSE; #ifdef DEBUG_TIMER printf("timerThreadFunction: waiting\n"); fflush(stdout); @@ -85,14 +84,9 @@ static void timerThreadFunction(void* data) { #endif it->osTimerData.signaled = ET_FALSE; it->timerFunction(it->timerFunctionData); - signaled = ET_TRUE; } } etMutex_leave(&timer_mutex); - - if (!signaled) { - etLogger_logError("timerThreadFunction: signaled timer NOT found\n"); - } } } @@ -100,9 +94,8 @@ static void timerHandler(int sig, siginfo_t *si, void *uc) { etTimer* timer = si->si_value.sival_ptr; int sval = 0; - etMutex_enter(&timer_mutex); + /* Do not acquire the timer mutex in the handler! See signal-safety in linux manual. */ timer->osTimerData.signaled = ET_TRUE; - etMutex_leave(&timer_mutex); sem_getvalue(&(timer_sema.osData), &sval); if (sval==0) @@ -164,8 +157,7 @@ void etTimer_construct(etTimer* self, etTime* timerInterval, etTimerFunction tim self->osTimerData.te.sigev_signo = TIMER_SIGNAL; self->osTimerData.te.sigev_value.sival_ptr = self; if (timer_create(CLOCK_REALTIME, &self->osTimerData.te, &self->osTimerData.timerid) != 0) { - fprintf(stderr, "etTimer_construct: failed creating a timer\n"); - fflush(stderr); + etLogger_logError("etTimer_construct: failed creating a timer"); return; } #ifdef DEBUG_TIMER @@ -207,7 +199,6 @@ void etTimer_start(etTimer* self){ etLogger_logErrorF("etTimer_start: failed starting a timer with errno %d", errno); break; } - fflush(stderr); } } } |