Port CountdownEvent to use a ManualResetEventSlim for all its waiting operations...
[mono.git] / mcs / class / corlib / System.Threading / AutoResetEvent.cs
index 48eebe04d6660dcbc0266cb0809755f4691fb8b5..589693de8ff0cec9407c601b594093096de65e33 100644 (file)
@@ -9,7 +9,7 @@
 //
 
 //
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004, 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 using System;
 using System.Runtime.CompilerServices;
 
+using System.Runtime.InteropServices;
+
 namespace System.Threading 
 {
 
-       public sealed class AutoResetEvent : WaitHandle 
+       [ComVisible (true)]
+       public sealed class AutoResetEvent : EventWaitHandle
        {
                // Constructor
-               public AutoResetEvent(bool initialState) {
-                       Handle = NativeEventCalls.CreateEvent_internal(false,initialState,null);
+               public AutoResetEvent (bool initialState)
+                       : base(initialState, EventResetMode.AutoReset)
+               {
                }
 
                // Methods
 
+/* Need BOOTSTRAP_NET_2_0 because System.Threading.Timer wants to use
+ * the Set and Reset methods that have moved to EventWaitHandle in the
+ * 2.0 profile
+ */
+#if BOOTSTRAP_NET_2_0
                public bool Set() {
                        CheckDisposed ();
                        
@@ -57,6 +66,6 @@ namespace System.Threading
                        
                        return(NativeEventCalls.ResetEvent_internal(Handle));
                }
-
+#endif
        }
 }