+#if YAZ_POSIX_THREADS
+ struct timespec abstime;
+ struct timeval now;
+
+ gettimeofday(&now, 0);
+ abstime.tv_sec = now.tv_sec;
+ abstime.tv_nsec = 1000000 + now.tv_usec * 1000;
+ if (abstime.tv_nsec > 1000000000) /* 1s = 1e9 ns */
+ {
+ abstime.tv_nsec -= 1000000000;
+ abstime.tv_sec++;
+ }
+ pthread_mutex_lock(&sleep_mutex);
+ pthread_cond_timedwait(&sleep_cond, &sleep_mutex, &abstime);
+ pthread_mutex_unlock(&sleep_mutex);
+#endif