Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[Dltk-dev] problems when running scripts in one thread but eval (hoover/scripting console) does it stuff in its own thread..

Hi,

i have here 2 thread dumps:

1> this is the real thread that runs the script and is not waiting for a resume because it hit a breakpoint

"AWT-EventQueue-0" prio=6 tid=0x3d098400 nid=0x1118 in Object.wait() [0x413ed000..0x413efd94]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        at org.eclipse.dltk.rhino.dbgp.DBGPStackManager.sendSuspend(DBGPStackManager.java:153)
        - locked <0x0b9cb250> (a org.eclipse.dltk.rhino.dbgp.DBGPStackManager)
        at org.eclipse.dltk.rhino.dbgp.DBGPStackManager.changeLine(DBGPStackManager.java:96)
        at org.eclipse.dltk.rhino.dbgp.DBGPDebugFrame.onLineChange(DBGPDebugFrame.java:83)
        at org.mozilla._javascript_.Interpreter.interpretLoop(Interpreter.java:4138)


2> this is an eval command (hoover or scripting console) but you see the real eval happens in another thread

"Debug command reader" prio=6 tid=0x37106800 nid=0x11d0 in Object.wait() [0x3a48e000..0x3a48fa94]
  java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        <skipped>
        at org.mozilla._javascript_.Context.evaluateString(Context.java:1233)
        at org.eclipse.dltk.rhino.dbgp.DBGPDebugFrame.eval(DBGPDebugFrame.java:132)
        at org.eclipse.dltk.rhino.dbgp.EvalCommand.parseAndExecute(EvalCommand.java:35)
        at org.eclipse.dltk.rhino.dbgp.DBGPDebugger.run(DBGPDebugger.java:518)


problem with this is that i can get deadlocks or other stuff because of the this.

How do other implementations do this?

the best thing would be when something is running and hits a break it goes into a wait but doesnt just wait to resume again
but waits for everythign

So when the Debug Command reader thread gets an eval or what ever. It puts this on the stack of things to do
and then waits the thread that is really waiting for all the stuff (the one that was in a break point suspend)
and that one does then also the eval. Until of course one of the events is resume then it goes on.

I guess i have to write then large parts of the rhino debugger implementation. But i was just wondering how other impls did this

johan
 
 

Back to the top