X-Git-Url: http://git.megacz.com/?p=nestedvm.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fnestedvm%2FUnixRuntime.java;h=0bed8ed27ef330538112c773149dacc134fec68d;hp=1466a9b27f8b76fd24d49d41d486a5eb01d90d1a;hb=2db6b04d7557a26e3b9e7440e7968aaec262216f;hpb=3a9347de699c1d52ae6ffe35c21fa30cea1c8033 diff --git a/src/org/ibex/nestedvm/UnixRuntime.java b/src/org/ibex/nestedvm/UnixRuntime.java index 1466a9b..0bed8ed 100644 --- a/src/org/ibex/nestedvm/UnixRuntime.java +++ b/src/org/ibex/nestedvm/UnixRuntime.java @@ -86,14 +86,21 @@ public abstract class UnixRuntime extends Runtime implements Cloneable { UnixRuntime[] tasks = gs.tasks; synchronized(gs) { if(pid != 0) { - if(tasks[pid] == null || tasks[pid].pid != pid) throw new Error("should never happen"); + UnixRuntime prev = tasks[pid]; + if(prev == null || prev == this || prev.pid != pid || prev.parent != parent) + throw new Error("should never happen"); + synchronized(parent.children) { + int i = parent.activeChildren.indexOf(prev); + if(i == -1) throw new Error("should never happen"); + parent.activeChildren.set(i,this); + } } else { int newpid = -1; int nextPID = gs.nextPID; - for(int i=nextPID;i