X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=sched.c;h=8deb7f383596162e97444c7766f6d15bc60eb92c;hb=5f04eea3b1c9a41417ed63e5348b2aabca5542fa;hp=4fc65b4b368627c9175f26a193199adcbd787c55;hpb=767a4a54c967bc4b80bd14d02e89fe91acd848dd;p=paraslash.git diff --git a/sched.c b/sched.c index 4fc65b4b..8deb7f38 100644 --- a/sched.c +++ b/sched.c @@ -137,12 +137,12 @@ int schedule(struct sched *s) again: FD_ZERO(&s->rfds); FD_ZERO(&s->wfds); - s->select_timeout = s->default_timeout; + s->timeout = s->default_timeout; s->max_fileno = -1; clock_get_realtime(&now_struct); sched_preselect(s); ret = s->select_function(s->max_fileno + 1, &s->rfds, &s->wfds, - &s->select_timeout); + s->timeout); if (ret < 0) return ret; if (ret == 0) { @@ -168,7 +168,7 @@ again: * \param tptr Identifies the task to reap. * * This function is similar to wait(2) in that it returns information about a - * terminated task and allows to release the resources associated with the + * terminated task which allows releasing the resources associated with the * task. Until this function is called, the terminated task remains in a zombie * state. * @@ -244,7 +244,7 @@ struct task *task_register(struct task_info *info, struct sched *s) assert(info->post_select); if (!s->task_list.next) - INIT_LIST_HEAD(&s->task_list); + init_list_head(&s->task_list); t->info = *info; t->name = para_strdup(info->name); @@ -370,7 +370,7 @@ void task_notify_all(struct sched *s, int err) */ void sched_min_delay(struct sched *s) { - s->select_timeout.tv_sec = s->select_timeout.tv_usec = 0; + s->timeout = 0; } /** @@ -387,8 +387,9 @@ void sched_min_delay(struct sched *s) */ void sched_request_timeout(struct timeval *to, struct sched *s) { - if (tv_diff(&s->select_timeout, to, NULL) > 0) - s->select_timeout = *to; + long unsigned ms = tv2ms(to); + if (s->timeout > ms) + s->timeout = ms; } /**