Commit 6ee69278 authored by Adam Wujek's avatar Adam Wujek 💬

userspace/libwr: shorten wrs_shm_get timeout for reader

Shorten timeout for opening shmem (wrs_shm_get). Clients use their own sleep
between tries.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 66fe672c
......@@ -11,7 +11,7 @@
#include <sys/mman.h>
#include <libwr/shmem.h>
#define SHM_LOCK_TIMEOUT 2
#define SHM_LOCK_TIMEOUT_MS 50 /* in ms */
/* Get wrs shared memory */
/* return NULL and set errno on error */
void *wrs_shm_get(enum wrs_shm_name name_id, char *name, unsigned long flags)
......@@ -64,7 +64,9 @@ void *wrs_shm_get(enum wrs_shm_name name_id, char *name, unsigned long flags)
usleep(10 * 1000);
clock_gettime(CLOCK_MONOTONIC, &tv2);
if (tv2.tv_sec - tv1.tv_sec < SHM_LOCK_TIMEOUT)
if ((tv2.tv_sec*1000 + tv2.tv_nsec/1000000)
- (tv1.tv_sec*1000 + tv1.tv_nsec/1000000)
< SHM_LOCK_TIMEOUT_MS)
continue;
errno = ETIMEDOUT;
......
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