Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRavi Pratap M <ravi@mono-cvs.ximian.com>2002-04-27 00:21:26 +0400
committerRavi Pratap M <ravi@mono-cvs.ximian.com>2002-04-27 00:21:26 +0400
commitdf9ce584856e563a1e458876620c4f63d64f3edb (patch)
tree9edf0690900f66a3b17884543f66772be6a4d279 /mcs/tests/test-107.cs
parent663bbf0c4970fd0b1fd61151578462c3c7ff0631 (diff)
2002-04-26 Ravi Pratap <ravi@ximian.com>
* test-105.cs, test-106.cs, test-107.cs : Add. svn path=/trunk/mcs/; revision=4071
Diffstat (limited to 'mcs/tests/test-107.cs')
-rw-r--r--mcs/tests/test-107.cs45
1 files changed, 45 insertions, 0 deletions
diff --git a/mcs/tests/test-107.cs b/mcs/tests/test-107.cs
new file mode 100644
index 00000000000..a5639efa8f0
--- /dev/null
+++ b/mcs/tests/test-107.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Threading;
+using System.Runtime.InteropServices;
+using System.Runtime.Remoting.Messaging;
+
+class Test {
+ delegate int SimpleDelegate (int a);
+
+ static int cb_state = 0;
+
+ static int F (int a) {
+ Console.WriteLine ("Test.F from delegate: " + a);
+ throw new NotImplementedException ();
+ }
+
+ static void async_callback (IAsyncResult ar)
+ {
+ AsyncResult ares = (AsyncResult)ar;
+ AsyncCallback ac = new AsyncCallback (async_callback);
+
+ Console.WriteLine ("Async Callback " + ar.AsyncState);
+ cb_state++;
+ SimpleDelegate d = (SimpleDelegate)ares.AsyncDelegate;
+
+ if (cb_state < 5)
+ d.BeginInvoke (cb_state, ac, cb_state);
+
+ //throw new NotImplementedException ();
+ }
+
+ static int Main () {
+ SimpleDelegate d = new SimpleDelegate (F);
+ AsyncCallback ac = new AsyncCallback (async_callback);
+
+ IAsyncResult ar1 = d.BeginInvoke (cb_state, ac, cb_state);
+
+ ar1.AsyncWaitHandle.WaitOne ();
+
+
+ while (cb_state < 5)
+ Thread.Sleep (200);
+
+ return 0;
+ }
+}