Properly check the maxstacksize asked for the Thread
[mono.git] / mcs / class / corlib / System.Threading / RegisteredWaitHandle.cs
index fe41fef32bfcd47ed71bbf957ca4cf360b0369f8..0293f44fc6327962e92c3c54a87b48089dff4431 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Runtime.InteropServices;
 
 namespace System.Threading
 {
-       public sealed class RegisteredWaitHandle : MarshalByRefObject
+       [ComVisible (true)]
+       public sealed class RegisteredWaitHandle
+#if !MOONLIGHT
+               : MarshalByRefObject
+#endif
        {
                WaitHandle _waitObject;
                WaitOrTimerCallback _callback;
@@ -86,8 +91,11 @@ namespace System.Threading
 
                private void DoCallBack (object timedOut)
                {
-                       if (_callback != null)
-                               _callback (_state, (bool)timedOut); 
+                       if (_callback != null) {
+                               try {
+                                       _callback (_state, (bool)timedOut); 
+                               } catch {}
+                       }
 
                        lock (this) 
                        {
@@ -97,6 +105,7 @@ namespace System.Threading
                        }
                }
 
+               [ComVisible (true)]
                public bool Unregister(WaitHandle waitObject) 
                {
                        lock (this)