X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=sched.h;h=e0ca0c011bb0d4838a4071098e4c172403fac015;hp=ada1cc106c068706fc175cc883450c17a237f4b7;hb=181beb316afad036ac01a778544c5dec0a8d51c7;hpb=ca006af72cef95b0aba3cad799badde47010a621 diff --git a/sched.h b/sched.h index ada1cc10..e0ca0c01 100644 --- a/sched.h +++ b/sched.h @@ -1,8 +1,4 @@ -/* - * Copyright (C) 2006 Andre Noll - * - * Licensed under the GPL v2. For licencing details see COPYING. - */ +/* Copyright (C) 2006 Andre Noll , see file COPYING. */ /** \file sched.h Sched and task structures and exported symbols from sched.c. */ @@ -17,10 +13,10 @@ * called after the select call. */ struct sched { - /** Initial value before any pre_select call. */ - struct timeval default_timeout; - /** The current timeout for the upcoming select call. */ - struct timeval select_timeout; + /** Initial value (in milliseconds) before any pre_select call. */ + int default_timeout; + /** The timeout (also in milliseconds) for the next select call. */ + int timeout; /** fds that should be watched for readability. */ fd_set rfds; /** fds that should be watched for writability. */ @@ -28,7 +24,7 @@ struct sched { /** Highest numbered file descriptor in any of the above fd sets. */ int max_fileno; /** If non-NULL, use this function instead of para_select. */ - int (*select_function)(int, fd_set *, fd_set *, struct timeval *); + int (*select_function)(int, fd_set *, fd_set *, int timeout); /** Tasks which have been registered to the scheduler. */ struct list_head task_list; }; @@ -84,3 +80,13 @@ void sched_request_timeout(struct timeval *to, struct sched *s); void sched_request_timeout_ms(long unsigned ms, struct sched *s); int sched_request_barrier(struct timeval *barrier, struct sched *s); int sched_request_barrier_or_min_delay(struct timeval *barrier, struct sched *s); + +static inline bool sched_read_ok(int fd, const struct sched *s) +{ + return FD_ISSET(fd, &s->rfds); +} + +static inline bool sched_write_ok(int fd, const struct sched *s) +{ + return FD_ISSET(fd, &s->wfds); +}