20,11 → 20,11 |
|
/** |
------------ |
CVS : $Id: conditio.c,v 1.2 2002-11-11 08:34:08 pj Exp $ |
CVS : $Id: conditio.c,v 1.3 2003-01-07 17:07:49 pj Exp $ |
|
File: $File$ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2002-11-11 08:34:08 $ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2003-01-07 17:07:49 $ |
------------ |
|
This file contains the condition variables handling functions. |
83,7 → 83,7 |
proc_table[i].cond_waiting = NULL; |
|
l = proc_table[i].task_level; |
level_table[l]->task_insert(l,i); |
level_table[l]->public_unblock(l,i); |
/* then, the kill_request flag is set, and when the task is rescheduled |
it autokill itself... */ |
|
129,7 → 129,7 |
p = iq_getfirst(&cond->waiters); |
|
l = proc_table[p].task_level; |
level_table[l]->task_insert(l,p); |
level_table[l]->public_unblock(l,p); |
|
scheduler(); |
} |
150,7 → 150,7 |
p = iq_getfirst(&cond->waiters); |
|
l = proc_table[p].task_level; |
level_table[l]->task_insert(l,p); |
level_table[l]->public_unblock(l,p); |
} while(!iq_isempty(&cond->waiters)); |
|
scheduler(); |
162,8 → 162,6 |
int cond_wait(cond_t *cond, mutex_t *mutex) |
{ |
LEVEL l; |
struct timespec ty; |
TIME tx; |
|
/* Why I used task_nopreempt???... because we have to unlock the mutex, |
and we can't call mutex_unlock after kern_context_save (the unlock |
200,19 → 198,10 |
/* now, we really block the task... */ |
proc_table[exec_shadow].context = kern_context_save(); |
|
/* 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(); |
|
l = proc_table[exec_shadow].task_level; |
level_table[l]->task_extract(l,exec_shadow); |
level_table[l]->public_block(l,exec_shadow); |
|
/* we insert the task in the condition queue */ |
proc_table[exec_shadow].status = WAIT_COND; |
278,7 → 267,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(); |
} |
288,8 → 277,6 |
{ |
LEVEL l; |
int returnvalue = 0; |
struct timespec ty; |
TIME tx; |
|
/* Why I used task_nopreempt???... because we have to unlock the mutex, |
and we can't call mutex_unlock after kern_context_save (the unlock |
326,19 → 313,10 |
/* now, we really block the task... */ |
proc_table[exec_shadow].context = kern_context_save(); |
|
/* 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(); |
|
l = proc_table[exec_shadow].task_level; |
level_table[l]->task_extract(l,exec_shadow); |
level_table[l]->public_block(l,exec_shadow); |
|
/* we insert the task in the condition queue */ |
proc_table[exec_shadow].status = WAIT_COND; |
361,7 → 339,7 |
ll_context_to(proc_table[exec_shadow].context); |
|
if (proc_table[exec_shadow].delay_timer != -1) |
event_delete(proc_table[exec_shadow].delay_timer); |
kern_event_delete(proc_table[exec_shadow].delay_timer); |
|
kern_sti(); |
|