3 --- event.cpp.orig 2007-07-16 17:54:23.000000000 +0000
7 //<decls and function prototypes
10 +#define timespeccmp(tvp, uvp, cmp) \
11 + (((tvp)->tv_sec == (uvp)->tv_sec) ? \
12 + ((tvp)->tv_nsec cmp (uvp)->tv_nsec) : \
13 + ((tvp)->tv_sec cmp (uvp)->tv_sec))
16 // my_mutex: protects my_thread_is_talking,
17 static pthread_mutex_t my_mutex;
18 @@ -398,10 +404,14 @@ ENTER("sleep_until_timeout_or_stop_reque
19 to.tv_sec, to.tv_nsec,
20 ts.tv_sec, ts.tv_nsec);
22 - while ((err = sem_timedwait(&my_sem_stop_is_required, &ts)) == -1
24 + while ((err = sem_trywait(&my_sem_stop_is_required)) == -1
25 + && (errno == EINTR || errno == EAGAIN))
27 - continue; // Restart when interrupted by handler
28 + struct timespec help;
29 + clock_gettime2(&help);
30 + if (timespeccmp(&help, &ts, >=))
35 assert (gettimeofday(&tv, NULL) != -1);