diff lib/js/urweb.js @ 1021:7a4a55e05081

Use call/cc for recv and sleep
author Adam Chlipala <adamc@hcoop.net>
date Sun, 25 Oct 2009 15:29:21 -0400
parents dfe34fad749d
children f87d0fedc54c
line wrap: on
line diff
--- a/lib/js/urweb.js	Sun Oct 25 14:07:10 2009 -0400
+++ b/lib/js/urweb.js	Sun Oct 25 15:29:21 2009 -0400
@@ -779,10 +779,10 @@
 
   var msg = dequeue(ch.msgs);
   if (msg == null) {
-    enqueue(ch.listeners, function(msg) { execF(execF(k, parse(msg)), null); });
+    enqueue(ch.listeners, function(msg) { k(parse(msg)); });
   } else {
     try {
-      execF(execF(k, parse(msg)), null);
+      k(parse(msg));
     } catch (v) {
       doExn(v);
     }
@@ -790,7 +790,11 @@
 }
 
 function sl(ms, k) {
-  window.setTimeout(function() { execF(k, null); }, ms);
+  window.setTimeout(function() { k(null); }, ms);
+}
+
+function sp(e) {
+  execF(e, null);
 }