Commit 59f08ce9 authored by Claes Sjofors's avatar Claes Sjofors

Plc thread loop, clock_nanosleep() was interrupted by the profinet stack

parent 05c27529
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
# include <signal.h> # include <signal.h>
# include <linux/capability.h> # include <linux/capability.h>
# include <sys/types.h> # include <sys/types.h>
# include <errno.h>
#endif #endif
#if defined OS_MACOS || defined OS_FREEBSD || defined OS_OPENBSD || defined OS_CYGWIN #if defined OS_MACOS || defined OS_FREEBSD || defined OS_OPENBSD || defined OS_CYGWIN
...@@ -349,9 +350,13 @@ scan ( ...@@ -349,9 +350,13 @@ scan (
nanosleep(&ts, NULL); nanosleep(&ts, NULL);
#else #else
struct timespec ts; struct timespec ts;
ts.tv_sec = tp->sync_time.tv_sec; ts.tv_sec = tp->sync_time.tv_sec;
ts.tv_nsec = tp->sync_time.tv_nsec; ts.tv_nsec = tp->sync_time.tv_nsec;
clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &ts, NULL); sts = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &ts, NULL);
while ( sts == EINTR)
/* The wait was interruped, continue to sleep */
sts = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &ts, NULL);
#endif #endif
} }
return; return;
...@@ -467,7 +472,10 @@ scan ( ...@@ -467,7 +472,10 @@ scan (
struct timespec ts; struct timespec ts;
ts.tv_sec = tp->sync_time.tv_sec; ts.tv_sec = tp->sync_time.tv_sec;
ts.tv_nsec = tp->sync_time.tv_nsec; ts.tv_nsec = tp->sync_time.tv_nsec;
clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &ts, NULL); sts = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &ts, NULL);
while ( sts == EINTR)
/* The wait was interruped, continue to sleep */
sts = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &ts, NULL);
#endif #endif
if (phase > 0) { if (phase > 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment