[System] Tweak socket test
[mono-project.git] / mono / tests / delegate-delegate-exit.cs
blob764e4ec9b422b01d054aeb7dec867c5739f0344f
1 using System;
2 using System.Threading;
3 using System.Runtime.InteropServices;
5 class foo {
6 delegate void foo_delegate ();
8 static void function () {
9 Console.WriteLine ("Delegate method");
10 Environment.Exit(0);
13 static void async_callback (IAsyncResult ar)
15 Console.WriteLine ("Async callback " + ar.AsyncState);
18 public static int Main () {
19 Environment.ExitCode = 2;
20 foo_delegate d = new foo_delegate (function);
21 AsyncCallback ac = new AsyncCallback (async_callback);
22 IAsyncResult ar1 = d.BeginInvoke (ac, "foo");
24 ar1.AsyncWaitHandle.WaitOne();
25 Thread.Sleep(1000);
26 d.EndInvoke(ar1);
28 Thread.Sleep(1000);
29 Console.WriteLine("Main returns");
30 return 1;