/* Dirty test */ using Nemerle.IO; using Nemerle.Concurrency; module Test { class A { public this () { printf ("A()\n") } [Async ()] public Test (n : int) : void { for (mutable i = 0; i < n; ++i) { printf ("+"); for (mutable j = 0; j < 2000000; ++j) { def k = (j + 1) * (i + 1); when (k % 449131 == i) printf ("!"); } } printf ("End of A.Test\n"); } /* UNUSED [ChordMember] public C4 () : void; */ [ChordMember] public C3 (s : string, u : int) : void; [ChordMember] public C2 (t : int) : void; public C1 (i : int) : int chord { | [C2, C3] => printf ("C1: %s\n", s); t + i * u } } class B : A { public this () { base (); printf ("B()\n") } [ChordMember] public cm1 (i : int) : void; [ChordMember] public cm2 (j : int) : void; [ChordMember] public cm3 () : void; public cm4 (k : int) : int chord { | [cm1, cm2, cm3] => i + j + k } [AsyncChord] public cma (o : int) : void { | [cm1, cm2, cm3] => printf ("in cma, i = %d, j = %d, o = %d\n", i, j, o); cm2 (j); cm3 () } } Main () : void { def a = A (); def b = B (); b.cma (9); a.C2 (4); printf ("C2 called\n"); async { printf ("waiting to call C3\n"); System.Threading.Thread.Sleep (5000); printf ("calling C3\n"); a.C3 ("xyz", 8); printf ("C3 called\n"); b.cm3 () } b.cm1 (1); b.cm1 (2); b.cm2 (3); printf ("calling C1\n"); def t = a.C1 (5); printf ("C1 called %d\n", t); printf ("cm4: %d\n", b.cm4 (8)); async { for (mutable i = 0; i < 1000; ++i) { printf ("."); } printf ("End of async block\n"); } a.Test (5); printf ("End of main thread\n"); } }