Added labels to blocking conditions.

This commit is contained in:
Michael Bebenita 2010-08-17 23:26:43 -07:00
parent 7ff39ea448
commit e20752de68
4 changed files with 13 additions and 8 deletions

View File

@ -363,9 +363,10 @@ rust_dom::log_state() {
log(rust_log::TASK, "blocked tasks:");
for (size_t i = 0; i < blocked_tasks.length(); i++) {
log(rust_log::TASK,
"\t task: %s @0x%" PRIxPTR ", blocked on: 0x%" PRIxPTR,
"\t task: %s @0x%" PRIxPTR ", blocked on: 0x%" PRIxPTR
" '%s'",
blocked_tasks[i]->name, blocked_tasks[i],
blocked_tasks[i]->cond);
blocked_tasks[i]->cond, blocked_tasks[i]->cond_name);
}
}
@ -373,7 +374,7 @@ rust_dom::log_state() {
log(rust_log::TASK, "dead tasks:");
for (size_t i = 0; i < dead_tasks.length(); i++) {
log(rust_log::TASK, "\t task: %s 0x%" PRIxPTR ", ref_count: %d",
dead_tasks[i], dead_tasks[i]->name,
dead_tasks[i]->name, dead_tasks[i],
dead_tasks[i]->ref_count);
}
}

View File

@ -63,6 +63,7 @@ rust_task::rust_task(rust_dom *dom, rust_task *spawner, const char *name) :
name(name),
state(&dom->running_tasks),
cond(NULL),
cond_name("none"),
supervisor(spawner),
idx(0),
rendezvous_ptr(0),
@ -552,7 +553,7 @@ rust_task::transition(ptr_vec<rust_task> *src, ptr_vec<rust_task> *dst)
}
void
rust_task::block(rust_cond *on)
rust_task::block(rust_cond *on, const char* name)
{
log(rust_log::TASK, "Blocking on 0x%" PRIxPTR ", cond: 0x%" PRIxPTR,
(uintptr_t) on, (uintptr_t) cond);
@ -561,6 +562,7 @@ rust_task::block(rust_cond *on)
transition(&dom->running_tasks, &dom->blocked_tasks);
cond = on;
cond_name = name;
}
void
@ -574,6 +576,7 @@ rust_task::wakeup(rust_cond *from)
transition(&dom->blocked_tasks, &dom->running_tasks);
I(dom, cond == from);
cond = NULL;
cond_name = "none";
}
void

View File

@ -24,6 +24,7 @@ rust_task : public maybe_proxy<rust_task>,
const char *const name;
ptr_vec<rust_task> *state;
rust_cond *cond;
const char *cond_name;
rust_task *supervisor; // Parent-link for failure propagation.
size_t idx;
size_t gc_alloc_thresh;
@ -70,7 +71,7 @@ rust_task : public maybe_proxy<rust_task>,
const char *state_str();
void transition(ptr_vec<rust_task> *svec, ptr_vec<rust_task> *dvec);
void block(rust_cond *on);
void block(rust_cond *on, const char* name);
void wakeup(rust_cond *from);
void die();
void unblock();

View File

@ -191,13 +191,13 @@ upcall_join(rust_task *task, maybe_proxy<rust_task> *target) {
if (target->is_proxy()) {
notify_message::
send(notify_message::JOIN, "join", task, target->as_proxy());
task->block(target_task);
task->block(target_task, "joining remote task");
task->yield(2);
} else {
// If the other task is already dying, we don't have to wait for it.
if (target_task->dead() == false) {
target_task->tasks_waiting_to_join.push(task);
task->block(target_task);
task->block(target_task, "joining local task");
task->yield(2);
}
}
@ -238,7 +238,7 @@ upcall_recv(rust_task *task, uintptr_t *dptr, rust_port *port) {
task->log(rust_log::COMM, "<=== waiting for rendezvous data ===");
task->rendezvous_ptr = dptr;
task->block(port);
task->block(port, "waiting for rendezvous data");
task->yield(3);
}