2009-09-12 Gonzalo Paniagua Javier <gonzalo@novell.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Sun, 13 Sep 2009 02:49:03 +0000 (02:49 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Sun, 13 Sep 2009 02:49:03 +0000 (02:49 -0000)
* AsyncResult.cs: lock when setting the 'completed' field and use the
property instead of the 'handle' field.

svn path=/trunk/mcs/; revision=141860

mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs
mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog

index 4ebb2409b19e303e125827fe916f825a5021abf6..775340819851bed06ae6b4d8b7233c287cc9f9c5 100644 (file)
@@ -142,7 +142,7 @@ public class AsyncResult : IAsyncResult, IMessageSink {
 
        internal IMessage EndInvoke ()
        {
-               handle.WaitOne ();
+               AsyncWaitHandle.WaitOne ();
                return reply_message;
        }
 
@@ -150,11 +150,12 @@ public class AsyncResult : IAsyncResult, IMessageSink {
        {
                reply_message = msg;
 
-               completed = true;
-               NativeEventCalls.SetEvent_internal (handle.Handle);
+               lock (this) {
+                       completed = true;
+                       ((ManualResetEvent) AsyncWaitHandle).Set ();
+               }
                
-               if (async_callback != null)
-               {
+               if (async_callback != null) {
                        AsyncCallback ac = (AsyncCallback) async_callback;
                        ac (this);
                }
index 402cfe86aba22c6b21a4dd61fff45952dfd4b959..6952f47ebcba1984997147c51f2a90f3d719ec2d 100644 (file)
@@ -1,3 +1,8 @@
+2009-09-12 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+       * AsyncResult.cs: lock when setting the 'completed' field and use the
+       property instead of the 'handle' field.
+
 2008-11-10 Gonzalo Paniagua Javier <gonzalo@novell.com>
 
        * CADMessages.cs: when the method is generic, return a constructed