Check correct thread state at finalization
Prevents external threads from being left in Running state when they finish, causing the virtual CPU to be always occupied with at least one thread. This situation causes the virtual CPU to never report any subsystem.
This commit is contained in:
parent
9407616c2b
commit
a1cc8ba87c
@ -45,6 +45,7 @@ add_library(emu STATIC
|
||||
ovni/probe.c
|
||||
ovni/create.c
|
||||
ovni/event.c
|
||||
ovni/finish.c
|
||||
nanos6/setup.c
|
||||
nanos6/event.c
|
||||
nosv/setup.c
|
||||
|
21
src/emu/ovni/finish.c
Normal file
21
src/emu/ovni/finish.c
Normal file
@ -0,0 +1,21 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "ovni_priv.h"
|
||||
|
||||
int
|
||||
ovni_finish(struct emu *emu)
|
||||
{
|
||||
struct system *sys = &emu->system;
|
||||
int ret = 0;
|
||||
|
||||
/* Ensure that all threads are in the Dead state */
|
||||
for (struct thread *t = sys->threads; t; t = t->gnext) {
|
||||
if (t->state != TH_ST_DEAD) {
|
||||
err("thread %d is not dead (%s)", t->tid, t->id);
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
@ -38,5 +38,6 @@ struct ovni_cpu {
|
||||
int ovni_probe(struct emu *emu);
|
||||
int ovni_create(struct emu *emu);
|
||||
int ovni_event(struct emu *emu);
|
||||
int ovni_finish(struct emu *emu);
|
||||
|
||||
#endif /* OVNI_PRIV_H */
|
||||
|
@ -10,6 +10,7 @@ struct model_spec model_ovni = {
|
||||
.connect = NULL,
|
||||
.event = ovni_event,
|
||||
.probe = ovni_probe,
|
||||
.finish = ovni_finish,
|
||||
};
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user