2009-09-27 Gonzalo Paniagua Javier <gonzalo@novell.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Sun, 27 Sep 2009 05:28:55 +0000 (05:28 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Sun, 27 Sep 2009 05:28:55 +0000 (05:28 -0000)
* AsyncResult.cs: don't create the handle if we know the result is
completed.

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

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

index 775340819851bed06ae6b4d8b7233c287cc9f9c5..f5a8ef92d4c29b2d018a19ac0db44e9ff6badbbd 100644 (file)
@@ -142,6 +142,11 @@ public class AsyncResult : IAsyncResult, IMessageSink {
 
        internal IMessage EndInvoke ()
        {
+               lock (this) {
+                       if (completed)
+                               return reply_message;
+               }
+
                AsyncWaitHandle.WaitOne ();
                return reply_message;
        }
index 6952f47ebcba1984997147c51f2a90f3d719ec2d..062a58805ac569816763a809e917efdfbbc091f3 100644 (file)
@@ -1,3 +1,8 @@
+2009-09-27 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+       * AsyncResult.cs: don't create the handle if we know the result is
+       completed.
+
 2009-09-12 Gonzalo Paniagua Javier <gonzalo@novell.com>
 
        * AsyncResult.cs: lock when setting the 'completed' field and use the