--- libaitsched/src/tasks.c 2012/01/24 14:04:58 1.4.2.3 +++ libaitsched/src/tasks.c 2012/03/13 10:01:59 1.6 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: tasks.c,v 1.4.2.3 2012/01/24 14:04:58 misho Exp $ +* $Id: tasks.c,v 1.6 2012/03/13 10:01:59 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 +Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -99,6 +99,7 @@ _sched_unuseTask(sched_task_t * __restrict task) /* * schedRead() - Add READ I/O task to scheduler queue + * * @root = root task * @func = task execution function * @arg = 1st func argument @@ -155,6 +156,7 @@ schedRead(sched_root_task_t * __restrict root, sched_t /* * schedWrite() - Add WRITE I/O task to scheduler queue + * * @root = root task * @func = task execution function * @arg = 1st func argument @@ -211,6 +213,7 @@ schedWrite(sched_root_task_t * __restrict root, sched_ /* * schedTimer() - Add TIMER task to scheduler queue + * * @root = root task * @func = task execution function * @arg = 1st func argument @@ -250,12 +253,12 @@ schedTimer(sched_root_task_t * __restrict root, sched_ clock_gettime(CLOCK_MONOTONIC, &now); now.tv_sec += ts.tv_sec; now.tv_nsec += ts.tv_nsec; - if (now.tv_nsec >= 1000000000) { + if (now.tv_nsec >= 1000000000L) { now.tv_sec++; - now.tv_nsec -= 1000000000; + now.tv_nsec -= 1000000000L; } else if (now.tv_nsec < 0) { now.tv_sec--; - now.tv_nsec += 1000000000; + now.tv_nsec += 1000000000L; } TASK_TS(task) = now; @@ -272,7 +275,7 @@ schedTimer(sched_root_task_t * __restrict root, sched_ TAILQ_INSERT_TAIL(&root->root_timer, task, task_node); #else TAILQ_FOREACH(t, &root->root_timer, task_node) - if (timespeccmp(&TASK_TS(task), &TASK_TS(t), -) < 1) + if (sched_timespeccmp(&TASK_TS(task), &TASK_TS(t), -) < 1) break; if (!t) TAILQ_INSERT_TAIL(&root->root_timer, task, task_node); @@ -290,6 +293,7 @@ schedTimer(sched_root_task_t * __restrict root, sched_ /* * schedEvent() - Add EVENT task to scheduler queue + * * @root = root task * @func = task execution function * @arg = 1st func argument @@ -347,6 +351,7 @@ schedEvent(sched_root_task_t * __restrict root, sched_ /* * schedEventLo() - Add EVENT_Lo task to scheduler queue + * * @root = root task * @func = task execution function * @arg = 1st func argument @@ -403,6 +408,7 @@ schedEventLo(sched_root_task_t * __restrict root, sche /* * schedCallOnce() - Call once from scheduler + * * @root = root task * @func = task execution function * @arg = 1st func argument