Revision: 4771
          http://sourceforge.net/p/vexi/code/4771
Author:   mkpg2
Date:     2015-02-26 21:53:55 +0000 (Thu, 26 Feb 2015)
Log Message:
-----------
Scheduler.runInCurrent() for write traps.

Modified Paths:
--------------
    branches/vexi3/org.vexi-library.js/src/main/java/org/ibex/js/Scheduler.java

Modified: 
branches/vexi3/org.vexi-library.js/src/main/java/org/ibex/js/Scheduler.java
===================================================================
--- branches/vexi3/org.vexi-library.js/src/main/java/org/ibex/js/Scheduler.java 
2015-02-26 18:31:38 UTC (rev 4770)
+++ branches/vexi3/org.vexi-library.js/src/main/java/org/ibex/js/Scheduler.java 
2015-02-26 21:53:55 UTC (rev 4771)
@@ -198,7 +198,7 @@
         // REMARK - isFirst <-> old == null?
         boolean isFirst = jsthread==null; 
         if (isFirst) {
-            setJSThread(newThread(this, "current/trap", trapf));
+            setJSThread(newThread(this, "current/rtrap", trapf));
         }
         Interpreter old = jsthread.currentInterpreter;
         jsthread.currentInterpreter = new Interpreter(jsthread, t, null, 
false, null);
@@ -213,6 +213,25 @@
         }
     }
     
+    public void runInCurrent(Trap t, JS put) throws JSExn {
+       JSFunction trapf = (JSFunction)t.function();
+        boolean isFirst = jsthread==null; 
+        if (isFirst) {
+            setJSThread(newThread(this, "current/rtrap", trapf));
+        }
+        Interpreter old = jsthread.currentInterpreter;
+        jsthread.currentInterpreter = new Interpreter(jsthread, t, put, false, 
null);
+        try {
+            jsthread.currentInterpreter.run(null);
+        } finally {
+            if (isFirst) {
+                jsthread.destroy();
+            } else {
+                jsthread.currentInterpreter = old;
+            }
+        }        
+    }
+    
     // Write traps
     // Split into two stages, 'before put' and 'after put'
     // This allows us to have trap execution that does what it wants 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to