4 // Tests for the 'synchronized' method attribute
8 using System.Threading;
9 using System.Runtime.CompilerServices;
13 [MethodImplAttribute(MethodImplOptions.Synchronized)]
20 [MethodImplAttribute(MethodImplOptions.Synchronized)]
21 public static int test_static () {
22 Monitor.Exit (typeof (Test));
23 Monitor.Enter (typeof (Test));
27 [MethodImplAttribute(MethodImplOptions.Synchronized)]
28 public int test_exception () {
30 throw new Exception ("A");
33 [MethodImplAttribute(MethodImplOptions.Synchronized)]
34 public virtual int test_virtual () {
40 public delegate int Delegate1 ();
42 static public int Main (String[] args) {
46 Console.WriteLine ("Test1...");
48 Console.WriteLine ("Test2...");
50 Console.WriteLine ("Test3...");
54 catch (SynchronizationLockException ex) {
57 catch (Exception ex) {
61 Console.WriteLine ("Test4...");
64 Console.WriteLine ("Test5...");
65 Delegate1 d = new Delegate1 (b.test);
68 Console.WriteLine ("Test6...");
69 d = new Delegate1 (test_static);
72 Console.WriteLine ("Test7...");
73 d = new Delegate1 (b.test_virtual);
76 Console.WriteLine ("Test8...");
77 d = new Delegate1 (b.test_exception);
81 catch (SynchronizationLockException ex) {
84 catch (Exception ex) {