Made the runtime keep track of all live domains and print their state.
This commit is contained in:
parent
c5744c8aef
commit
56cd4e458a
2 changed files with 16 additions and 0 deletions
|
@ -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
|
||||
|
@ -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()) {
|
||||
|
|
|
@ -84,6 +84,7 @@ struct rust_dom
|
|||
int start_main_loop();
|
||||
|
||||
void log_state();
|
||||
static void log_all_state();
|
||||
};
|
||||
|
||||
//
|
||||
|
|
Loading…
Add table
Reference in a new issue