aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rt/rust_dom.cpp15
-rw-r--r--src/rt/rust_dom.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/src/rt/rust_dom.cpp b/src/rt/rust_dom.cpp
index 99aaddb2..97e32746 100644
--- a/src/rt/rust_dom.cpp
+++ b/src/rt/rust_dom.cpp
@@ -4,6 +4,8 @@
template class ptr_vec<rust_task>;
+// Keeps track of all live domains, for debugging purposes.
+array_list<rust_dom*> _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
@@ -322,6 +330,13 @@ rust_dom::schedule_task()
}
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()) {
log(rust_log::TASK, "running tasks:");
diff --git a/src/rt/rust_dom.h b/src/rt/rust_dom.h
index 528790d5..4f3a91dc 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();
};
//