Index: tests/exceptions/.expect/pingpong_nonlocal.txt
===================================================================
--- tests/exceptions/.expect/pingpong_nonlocal.txt	(revision c3f7dd96497f906c0a6461c6f12210459f2a0cef)
+++ tests/exceptions/.expect/pingpong_nonlocal.txt	(revision a2eb21a3e75fa9dd8fd465b9179ac734db266da5)
@@ -1,2 +1,108 @@
-start
-done
+main start
+ping start
+pong start
+pong catchResume 0 0
+ping catchResume 0 1
+pong catchResume 0 2
+ping catchResume 1 3
+pong catchResume 2 4
+ping catchResume 3 5
+pong catchResume 4 6
+ping catchResume 5 7
+pong catchResume 6 8
+ping catchResume 7 9
+pong catchResume 8 10
+ping catchResume 9 11
+pong catchResume 10 12
+ping catchResume 11 13
+pong catchResume 12 14
+ping catchResume 13 15
+pong catchResume 14 16
+ping catchResume 15 17
+pong catchResume 16 18
+ping catchResume 17 19
+pong catchResume 18 20
+ping catchResume 19 21
+pong catchResume 20 22
+ping catchResume 21 23
+pong catchResume 22 24
+ping catchResume 23 25
+pong catchResume 24 26
+ping catchResume 25 27
+pong catchResume 26 28
+ping catchResume 27 29
+pong catchResume 28 30
+ping catchResume 29 31
+pong catchResume 30 32
+ping catchResume 31 33
+pong catchResume 32 34
+ping catchResume 33 35
+pong catchResume 34 36
+ping catchResume 35 37
+pong catchResume 36 38
+ping catchResume 37 39
+pong catchResume 38 40
+ping catchResume 39 41
+pong catchResume 40 42
+ping catchResume 41 43
+pong catchResume 42 44
+ping catchResume 43 45
+pong catchResume 44 46
+ping catchResume 45 47
+pong catchResume 46 48
+ping catchResume 47 49
+pong catchResume 48 50
+ping catchResume 49 51
+pong catchResume 50 52
+ping catchResume 51 53
+pong catchResume 52 54
+ping catchResume 53 55
+pong catchResume 54 56
+ping catchResume 55 57
+pong catchResume 56 58
+ping catchResume 57 59
+pong catchResume 58 60
+ping catchResume 59 61
+pong catchResume 60 62
+ping catchResume 61 63
+pong catchResume 62 64
+ping catchResume 63 65
+pong catchResume 64 66
+ping catchResume 65 67
+pong catchResume 66 68
+ping catchResume 67 69
+pong catchResume 68 70
+ping catchResume 69 71
+pong catchResume 70 72
+ping catchResume 71 73
+pong catchResume 72 74
+ping catchResume 73 75
+pong catchResume 74 76
+ping catchResume 75 77
+pong catchResume 76 78
+ping catchResume 77 79
+pong catchResume 78 80
+ping catchResume 79 81
+pong catchResume 80 82
+ping catchResume 81 83
+pong catchResume 82 84
+ping catchResume 83 85
+pong catchResume 84 86
+ping catchResume 85 87
+pong catchResume 86 88
+ping catchResume 87 89
+pong catchResume 88 90
+ping catchResume 89 91
+pong catchResume 90 92
+ping catchResume 91 93
+pong catchResume 92 94
+ping catchResume 93 95
+pong catchResume 94 96
+ping catchResume 95 97
+pong catchResume 96 98
+ping catchResume 97 99
+pong catch 98 100
+pong end
+ping catch 99 101
+ping end
+main end
Index: tests/exceptions/pingpong_nonlocal.cfa
===================================================================
--- tests/exceptions/pingpong_nonlocal.cfa	(revision c3f7dd96497f906c0a6461c6f12210459f2a0cef)
+++ tests/exceptions/pingpong_nonlocal.cfa	(revision a2eb21a3e75fa9dd8fd465b9179ac734db266da5)
@@ -1,66 +1,58 @@
 #include <fstream.hfa>
 #include <thread.hfa>
-#include <coroutine.hfa>
-#include <stdlib.hfa>
 #include <fstream.hfa>
+#include <mutex_stmt.hfa>
 
-exception num_pings { int num; };
-vtable(num_pings) num_pings_vt;
+exception num_ping_pongs { int num; };
+vtable(num_ping_pongs) num_ping_pongs_vt;
 
-exception num_pongs { int num; };
-vtable(num_pongs) num_pongs_vt;
+thread Ping_Pong {
+	char * name;
+	int cnt;
+	num_ping_pongs except;
+	Ping_Pong & partner;
+};
 
-thread Ping;
-thread Pong { Ping & p; int cnt; };
-thread Ping { Pong & p; int cnt; };
-
-int numtimes = 100000;
-
-void main( Pong & this ) with(this) {
-    try {
-        for ( ;; ) {
-            while( !poll( this ) ) {}
-            num_pongs except{ &num_pongs_vt, cnt + 1 };
-            resumeAt( p, except );
-        }
-    } catchResume ( num_pings * e; e->num < numtimes ) {
-        cnt = e->num;
-    } catch( num_pings * e ) {
-        if ( e->num == numtimes ){
-            num_pongs except{ &num_pongs_vt, e->num + 1 };
-            resumeAt( p, except );
-        }
-    }
+void ?{}( Ping_Pong & this, char * name ) with( this ) {
+	this.name = name;
+	cnt = 0;
+	?{}( except, &num_ping_pongs_vt, 0 );
 }
 
-void main( Ping & this ) with(this) {
-    try {
-        for ( ;; ) {
-            while( !poll( this ) ) {}
-            num_pings except{ &num_pings_vt, cnt + 1 };
-            resumeAt( p, except );
-        }
-    } catchResume ( num_pongs * e; e->num < numtimes ) {
-        cnt = e->num;
-    } catch( num_pongs * e ) {
-        if ( e->num == numtimes ){
-            num_pings except{ &num_pings_vt, e->num + 1 };
-            resumeAt( p, except );
-        }
-    }
+int numtimes = 100;
+
+void main( Ping_Pong & this ) with( this ) {
+	void inc_resume_at( int value ) {
+		except.num = value + 1;
+		resumeAt( partner, except );
+	}
+	mutex( sout ) sout | name | "start";
+	try {
+		for () {
+			while( ! poll( this ) ) { yield(); }
+            inc_resume_at( cnt );
+		}
+	} catchResume( num_ping_pongs * e; e->num < numtimes ) {
+		mutex( sout ) sout | name | "catchResume" | cnt | e->num;
+		cnt = e->num;
+	} catch( num_ping_pongs * e ) {
+		mutex( sout ) sout | name | "catch" | cnt | e->num;
+		if ( e->num == numtimes ) {
+            inc_resume_at( e->num );
+		}
+	}
+	mutex( sout ) sout | name | "end";
 }
 
 int main() {
-    processor p;
-    sout | "start";
-    {
-        Ping ping;
-        Pong pong;
-        &ping.p = &pong;
-        &pong.p = &ping;
-        num_pings except{ &num_pings_vt, 0 };
-        resumeAt( pong, except );
-    }
-    sout | "done";
+	processor p;
+	sout | "main start";
+	{
+		Ping_Pong ping { "ping" }, pong{ "pong" };
+		&ping.partner = &pong;							// create cycle
+		&pong.partner = &ping;
+		num_ping_pongs except{ &num_ping_pongs_vt, 0 };
+		resumeAt( pong, except );
+	}
+	sout | "main end";
 }
-
