18,11 → 18,11 |
|
/** |
------------ |
CVS : $Id: nanoslp.c,v 1.1.1.1 2002-03-29 14:12:52 pj Exp $ |
CVS : $Id: nanoslp.c,v 1.2 2003-01-07 17:07:49 pj Exp $ |
|
File: $File$ |
Revision: $Revision: 1.1.1.1 $ |
Last update: $Date: 2002-03-29 14:12:52 $ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2003-01-07 17:07:49 $ |
------------ |
|
This file contains the nanosleep function (posix 14.2.5) and related |
82,13 → 82,13 |
/* the task that have to be killed is waiting on a nanosleep */ |
|
/* the nanosleep event have to be removed */ |
event_delete(proc_table[i].delay_timer); |
kern_event_delete(proc_table[i].delay_timer); |
proc_table[i].delay_timer = -1; |
|
/* and the task have to be reinserted into the ready queues, so it |
will fall into task_testcancel */ |
l = proc_table[i].task_level; |
level_table[l]->task_insert(l,i); |
level_table[l]->public_unblock(l,i); |
|
return 1; |
} |
104,18 → 104,18 |
if (proc_table[i].status == WAIT_NANOSLEEP) { |
/* the task is waiting on a nanosleep and it is still receiving a |
signal... */ |
ll_gettime(TIME_EXACT,&t1); |
kern_gettime(&t1); |
SUBTIMESPEC(&nanosleep_table[i], &t1, &t2); |
TIMESPEC_ASSIGN(&nanosleep_table[i], &t2); |
|
/* the nanosleep event have to be removed */ |
event_delete(proc_table[i].delay_timer); |
kern_event_delete(proc_table[i].delay_timer); |
proc_table[i].delay_timer = -1; |
|
/* and the task have to be reinserted into the ready queues, so it |
will fall into task_testcancel */ |
l = proc_table[i].task_level; |
level_table[l]->task_insert(l,i); |
level_table[l]->public_unblock(l,i); |
|
return 1; |
} |
133,7 → 133,7 |
proc_table[p].delay_timer = -1; |
|
l = proc_table[p].task_level; |
level_table[l]->task_insert(l,p); |
level_table[l]->public_unblock(l,p); |
|
event_need_reschedule(); |
} |
141,8 → 141,6 |
|
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp) |
{ |
struct timespec ty; |
TIME tx; |
LEVEL l; |
|
if (rqtp->tv_sec < 0 || rqtp->tv_nsec > 1000000000) |
158,20 → 156,11 |
register_interruptable_point(nanosleep_interrupted_by_signal, NULL); |
} |
|
/* SAME AS SCHEDULER... manage the capacity event and the load_info */ |
ll_gettime(TIME_EXACT, &schedule_time); |
SUBTIMESPEC(&schedule_time, &cap_lasttime, &ty); |
tx = TIMESPEC2USEC(&ty); |
proc_table[exec_shadow].avail_time -= tx; |
jet_update_slice(tx); |
if (cap_timer != NIL) { |
event_delete(cap_timer); |
cap_timer = NIL; |
} |
kern_epilogue_macro(); |
|
/* now, we block the current task, waiting the end of the target task */ |
l = proc_table[exec_shadow].task_level; |
level_table[l]->task_extract(l,exec_shadow); |
level_table[l]->public_block(l,exec_shadow); |
proc_table[exec_shadow].status = WAIT_NANOSLEEP; |
|
ADDTIMESPEC(&schedule_time, rqtp, &nanosleep_table[exec_shadow]); |