--- libaitsched/src/aitsched.c 2012/01/24 14:04:58 1.4.2.4 +++ libaitsched/src/aitsched.c 2012/01/24 14:34:49 1.4.2.5 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitsched.c,v 1.4.2.4 2012/01/24 14:04:58 misho Exp $ +* $Id: aitsched.c,v 1.4.2.5 2012/01/24 14:34:49 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -480,6 +480,31 @@ schedRun(sched_root_task_t * __restrict root, volatile while ((task = root->root_hooks.hook_exec.fetch(root, NULL))) schedCall(task); } + + return 0; +} + +/* + * schedPolling() - Polling timeout period if no timer task is present + * @root = root task + * @ts = timeout polling period, if ==NULL INFINIT timeout + * @tsold = old timeout polling if !=NULL + * return: -1 error or 0 ok + */ +inline int +schedPolling(sched_root_task_t * __restrict root, struct timespec * __restrict ts, + struct timespec * __restrict tsold) +{ + if (!root) + return -1; + + if (tsold) + *tsold = root->root_poll; + + if (!ts) + root->root_poll.tv_sec = root->root_poll.tv_nsec = -1; + else + root->root_poll = *ts; return 0; }