aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Bebenita <[email protected]>2010-08-17 23:26:43 -0700
committerMichael Bebenita <[email protected]>2010-08-17 23:49:57 -0700
commite20752de68fe336e9fa184bef0616e31c738452c (patch)
treecc2280b968295fbe7c75244a5569c69ca00ef775 /src
parentFixed deadlock by removing channel flushing. (diff)
downloadrust-e20752de68fe336e9fa184bef0616e31c738452c.tar.xz
rust-e20752de68fe336e9fa184bef0616e31c738452c.zip
Added labels to blocking conditions.
Diffstat (limited to 'src')
-rw-r--r--src/rt/rust_dom.cpp7
-rw-r--r--src/rt/rust_task.cpp5
-rw-r--r--src/rt/rust_task.h3
-rw-r--r--src/rt/rust_upcall.cpp6
4 files changed, 13 insertions, 8 deletions
diff --git a/src/rt/rust_dom.cpp b/src/rt/rust_dom.cpp
index e49eeb22..c41e2688 100644
--- a/src/rt/rust_dom.cpp
+++ b/src/rt/rust_dom.cpp
@@ -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);
}
}
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp
index cd38433e..12623255 100644
--- a/src/rt/rust_task.cpp
+++ b/src/rt/rust_task.cpp
@@ -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
diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h
index b66ee5a1..9a4e0c7b 100644
--- a/src/rt/rust_task.h
+++ b/src/rt/rust_task.h
@@ -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();
diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp
index fb85233c..a3373870 100644
--- a/src/rt/rust_upcall.cpp
+++ b/src/rt/rust_upcall.cpp
@@ -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);
}