version 1.2, 2011/10/04 12:34:33
|
version 1.2.2.1, 2011/10/04 20:12:01
|
Line 157 schedWrite(sched_root_task_t * __restrict root, sched_
|
Line 157 schedWrite(sched_root_task_t * __restrict root, sched_
|
* @root = root task |
* @root = root task |
* @func = task execution function |
* @func = task execution function |
* @arg = 1st func argument |
* @arg = 1st func argument |
* @ms = arguments in microSecs, define period 1sec == 1000000 | * @tv = timeout argument structure |
* return: NULL error or !=NULL new queued task |
* return: NULL error or !=NULL new queued task |
*/ |
*/ |
sched_task_t * |
sched_task_t * |
schedTimer(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg, u_int ms) | schedTimer(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg, struct timeval tv) |
{ |
{ |
sched_task_t *task, *t = NULL; |
sched_task_t *task, *t = NULL; |
void *ptr; |
void *ptr; |
Line 192 schedTimer(sched_root_task_t * __restrict root, sched_
|
Line 192 schedTimer(sched_root_task_t * __restrict root, sched_
|
|
|
/* calculate timeval structure */ |
/* calculate timeval structure */ |
clock_gettime(CLOCK_MONOTONIC, &nw); |
clock_gettime(CLOCK_MONOTONIC, &nw); |
now.tv_sec = nw.tv_sec + ms / 1000000; | now.tv_sec = nw.tv_sec + tv.tv_sec; |
now.tv_usec = nw.tv_nsec / 1000 + (ms % 1000000); | now.tv_usec = nw.tv_nsec / 1000 + tv.tv_usec; |
if (now.tv_usec >= 1000000) { |
if (now.tv_usec >= 1000000) { |
now.tv_sec++; |
now.tv_sec++; |
now.tv_usec -= 1000000; |
now.tv_usec -= 1000000; |