/** \file sched.c Paraslash's scheduling functions. */
#include <regex.h>
-#include <dirent.h> /* readdir() */
#include <assert.h>
#include <sys/time.h>
struct task *t, *tmp;
list_for_each_entry_safe(t, tmp, &post_select_list, post_select_node) {
- call_post_select(s, t);
+ if (t->error >= 0)
+ call_post_select(s, t);
// PARA_INFO_LOG("%s: %d\n", t->status, t->ret);
if (t->error >= 0)
continue;
* \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.
+ * 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;
}