From 56cd4e458a6c3cd40a8ee2ceb0a0fdab0352bf20 Mon Sep 17 00:00:00 2001 From: Michael Bebenita Date: Mon, 9 Aug 2010 07:34:11 -0700 Subject: [PATCH] Made the runtime keep track of all live domains and print their state. --- src/rt/rust_dom.cpp | 15 +++++++++++++++ src/rt/rust_dom.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/rt/rust_dom.cpp b/src/rt/rust_dom.cpp index 99aaddb2b15..97e327463c3 100644 --- a/src/rt/rust_dom.cpp +++ b/src/rt/rust_dom.cpp @@ -4,6 +4,8 @@ template class ptr_vec; +// Keeps track of all live domains, for debugging purposes. +array_list _live_domains; rust_dom::rust_dom(rust_srv *srv, rust_crate const *root_crate) : interrupt_flag(0), @@ -26,6 +28,10 @@ rust_dom::rust_dom(rust_srv *srv, rust_crate const *root_crate) : pthread_attr_setdetachstate(&attr, true); #endif root_task = new (this) rust_task(this, NULL); + + if (_live_domains.replace(NULL, this) == false) { + _live_domains.append(this); + } } static void @@ -73,6 +79,8 @@ rust_dom::~rust_dom() { #endif while (caches.length()) delete caches.pop(); + + _live_domains.replace(this, NULL); } void @@ -321,6 +329,13 @@ rust_dom::schedule_task() return NULL; } +void +rust_dom::log_all_state() { + for (uint32_t i = 0; i < _live_domains.size(); i++) { + _live_domains[i]->log_state(); + } +} + void rust_dom::log_state() { if (!running_tasks.is_empty()) { diff --git a/src/rt/rust_dom.h b/src/rt/rust_dom.h index 528790d56cc..4f3a91dcc4b 100644 --- a/src/rt/rust_dom.h +++ b/src/rt/rust_dom.h @@ -84,6 +84,7 @@ struct rust_dom int start_main_loop(); void log_state(); + static void log_all_state(); }; //