FD_ZERO(&s->wfds);
}
gettimeofday(now, NULL);
+ } else {
+ FD_ZERO(&s->rfds);
+ FD_ZERO(&s->wfds);
}
sched_post_select(s);
if (list_empty(&pre_select_list) && list_empty(&post_select_list))
* \param barrier Absolute time before select() should return.
* \param s Pointer to the scheduler struct.
*
- * If \a barrier is in the past, this function does nothing.
+ * \return If \a barrier is in the past, this function does nothing and returns
+ * zero. Otherwise it returns one.
*
* \sa sched_request_barrier_or_min_delay().
*/
-void sched_request_barrier(struct timeval *barrier, struct sched *s)
+int sched_request_barrier(struct timeval *barrier, struct sched *s)
{
struct timeval diff;
if (tv_diff(now, barrier, &diff) > 0)
- return;
+ return 0;
sched_request_timeout(&diff, s);
+ return 1;
}
/**
* \param barrier Absolute time before select() should return.
* \param s Pointer to the scheduler struct.
*
- * If \a barrier is in the past, this function requests a minimal timeout.
+ * \return If \a barrier is in the past, this function requests a minimal
+ * timeout and returns zero. Otherwise it returns one.
*
* \sa sched_min_delay(), sched_request_barrier().
*/
-void sched_request_barrier_or_min_delay(struct timeval *barrier, struct sched *s)
+int sched_request_barrier_or_min_delay(struct timeval *barrier, struct sched *s)
{
struct timeval diff;
- if (tv_diff(now, barrier, &diff) > 0)
- return sched_min_delay(s);
+ if (tv_diff(now, barrier, &diff) > 0) {
+ sched_min_delay(s);
+ return 0;
+ }
sched_request_timeout(&diff, s);
+ return 1;
}