2010-05-21 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Fri, 21 May 2010 03:27:39 +0000 (03:27 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Fri, 21 May 2010 03:27:39 +0000 (03:27 -0000)
* HttpReplyChannel.cs : use manual reset.
* AspNetReplyChannel.cs : make it equivalent to the above.

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

mcs/class/System.ServiceModel/System.ServiceModel.Channels/AspNetReplyChannel.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog
mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpReplyChannel.cs

index 8b083f5e9847f3d5eb19f145ae39ee9a6ade9558..572ef0033480bda1fe5db4ca340d6c805e9abf3c 100644 (file)
@@ -41,7 +41,7 @@ namespace System.ServiceModel.Channels
                AspNetChannelListener<IReplyChannel> listener;
                List<HttpContext> waiting = new List<HttpContext> ();
                HttpContext http_context;
-               AutoResetEvent wait;
+               ManualResetEvent wait;
 
                public AspNetReplyChannel (AspNetChannelListener<IReplyChannel> listener)
                        : base (listener)
@@ -157,11 +157,10 @@ namespace System.ServiceModel.Channels
                        if (wait != null)
                                throw new InvalidOperationException ("Another wait operation is in progress");
                        try {
-                               wait = new AutoResetEvent (false);
+                               var wait_ = new ManualResetEvent (false);
+                               wait = wait_;
                                listener.ListenerManager.GetHttpContextAsync (timeout, HttpContextAcquired);
-                               if (wait != null) // in case callback is done before WaitOne() here.
-                                       return wait.WaitOne (timeout, false);
-                               return waiting.Count > 0;
+                               return wait_.WaitOne (timeout, false) && waiting.Count > 0;
                        } finally {
                                wait = null;
                        }
index 9b4c0e0f020c86a511393cf7548a94087908fd73..10cc62878ba87f9619f492b11911413dcfea713d 100755 (executable)
@@ -1,3 +1,8 @@
+2010-05-21  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * HttpReplyChannel.cs : use manual reset.
+       * AspNetReplyChannel.cs : make it equivalent to the above.
+
 2010-05-21  Atsushi Enomoto  <atsushi@ximian.com>
 
        * HttpChannelListener.cs : do not accept more than one channel at a
index 3cf3ec29891d7e12e8ef39c421dc7891715017b2..933d726c1137da1e431312b5c0f64e9576dae6c9 100644 (file)
@@ -160,14 +160,14 @@ Console.WriteLine (buf.CreateMessage ());
                        return true;
                }
 
-               AutoResetEvent wait;
+               ManualResetEvent wait;
 
                public override bool WaitForRequest (TimeSpan timeout)
                {
                        if (wait != null)
                                throw new InvalidOperationException ("Another wait operation is in progress");
                        try {
-                               var wait_ = new AutoResetEvent (false);
+                               var wait_ = new ManualResetEvent (false);
                                wait = wait_;   // wait can be set to null if HttpContextAcquired runs to completion before we do WaitOne
                                source.ListenerManager.GetHttpContextAsync (timeout, HttpContextAcquired);
                                return wait_.WaitOne (timeout, false) && waiting.Count > 0;