- struct timespec timeout;
-
- timeout.tv_sec = next_flush.tv_sec - now.tv_sec;
- if (next_flush.tv_nsec < (1000 * now.tv_usec))
- {
- timeout.tv_sec--;
- timeout.tv_nsec = 1000000000 + next_flush.tv_nsec
- - (1000 * now.tv_usec);
- }
- else
+ status = pthread_cond_timedwait (&cache_cond, &cache_lock, &next_flush);
+ if ((status != 0) && (status != ETIMEDOUT))