I think I know what's wrong here: it's not two actual threads waiting for each other, it's the inner and outer Nasal levels of thread 1, that think they're separate threads when they're not.

If it is that, the attached should fix it, but since I've never had this problem myself I can't test it.
Description: Fix hang in nested Nasal calls

naCall() increments Nasal's "active threads" count; as Nasal's garbage
collector first asks all other threads to stop and waits for them to
say they have, this can cause a hang when used in a function that was
itself called from Nasal (inner function's GC waiting for outer function
to say it has stopped, outer function waiting for inner function to return).

naCallMethodCtx() doesn't, to avoid exactly this problem.
(simgear simgear/nasal/nasal.h:108)

(Deliberately not changing NasalXMLVisitor: that already uses naSubContext,
another mechanism to do the same thing.)

Author: Rebecca Palmer
Bug-Debian: https://bugs.debian.org/750939

--- flightgear-3.0.0.orig/src/Scripting/NasalSys.cxx
+++ flightgear-3.0.0/src/Scripting/NasalSys.cxx
@@ -872,7 +872,7 @@ naRef FGNasalSys::wrappedPropsNode(SGPro
     naRef args[1];
     args[0] = propNodeGhost(aProps);
     naContext ctx = naNewContext();
-    naRef wrapped = naCall(ctx, _wrappedNodeFunc, 1, args, naNil(), naNil());
+    naRef wrapped = naCallMethodCtx(ctx, _wrappedNodeFunc, naNil(), 1, args, naNil());
     naFreeContext(ctx);
     return wrapped;
 }

Reply via email to