diff options
Diffstat (limited to 'src/daemon/dlt_daemon_common.h')
-rw-r--r-- | src/daemon/dlt_daemon_common.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/daemon/dlt_daemon_common.h b/src/daemon/dlt_daemon_common.h index 112cb92..be29bca 100644 --- a/src/daemon/dlt_daemon_common.h +++ b/src/daemon/dlt_daemon_common.h @@ -97,8 +97,12 @@ extern "C" { /* Use a semaphore or mutex from your OS to prevent concurrent access to the DLT buffer. */ -# define DLT_DAEMON_SEM_LOCK() { sem_wait(&dlt_daemon_mutex); } -# define DLT_DAEMON_SEM_FREE() { sem_post(&dlt_daemon_mutex); } +#define DLT_DAEMON_SEM_LOCK() do{\ + while ((sem_wait(&dlt_daemon_mutex) == -1) && (errno == EINTR)) \ + continue; /* Restart if interrupted */ \ + } while(0) + +#define DLT_DAEMON_SEM_FREE() { sem_post(&dlt_daemon_mutex); } extern sem_t dlt_daemon_mutex; /** |