From 97d6342bf08e55f8d2b4f8df5c4b5a099df0191c Mon Sep 17 00:00:00 2001 From: Michael Bebenita Date: Mon, 9 Aug 2010 08:15:34 -0700 Subject: Synthesize a flush_chan upcall right before a channel's ref_count drops to zero. This should only happen in the Rust code and not in the drop glue, or on the unwind path. This change allows the task owning the channel to block on a flush and delete its own channel. This change also cleans up some code around rust_port and rust_chan. --- src/rt/rust_dom.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'src/rt/rust_dom.cpp') diff --git a/src/rt/rust_dom.cpp b/src/rt/rust_dom.cpp index b66fca829fb..af1472520ba 100644 --- a/src/rt/rust_dom.cpp +++ b/src/rt/rust_dom.cpp @@ -237,7 +237,6 @@ rust_dom::reap_dead_tasks() { rust_task *task = dead_tasks[i]; if (task->ref_count == 0) { I(this, task->tasks_waiting_to_join.is_empty()); - dead_tasks.swap_delete(task); log(rust_log::TASK, "deleting unreferenced dead task 0x%" PRIxPTR, task); @@ -392,10 +391,9 @@ rust_dom::start_main_loop() // if progress is made in other domains. if (scheduled_task == NULL) { - log(rust_log::TASK, - "all tasks are blocked, waiting for progress ..."); - if (_log.is_tracing(rust_log::TASK)) + if (_log.is_tracing(rust_log::TASK)) { log_state(); + } log(rust_log::TASK, "all tasks are blocked, scheduler yielding ..."); sync::yield(); @@ -437,18 +435,6 @@ rust_dom::start_main_loop() log(rust_log::DOM, "terminated scheduler loop, reaping dead tasks ..."); while (dead_tasks.length() > 0) { - log(rust_log::DOM, - "waiting for %d dead tasks to become dereferenced ...", - dead_tasks.length()); - - if (_log.is_tracing(rust_log::DOM)) { - for (size_t i = 0; i < dead_tasks.length(); i++) { - log(rust_log::DOM, - "task: 0x%" PRIxPTR ", index: %d, ref_count: %d", - dead_tasks[i], i, dead_tasks[i]->ref_count); - } - } - if (_incoming_message_queue.is_empty()) { log(rust_log::DOM, "waiting for %d dead tasks to become dereferenced, " -- cgit 1.4.1-3-g733a5