From 766a1123cad8d05f82fd5aa38776221bbc4abb46 Mon Sep 17 00:00:00 2001 From: Atsushi Eno Date: Fri, 21 May 2010 03:27:39 +0000 Subject: [PATCH] 2010-05-21 Atsushi Enomoto * HttpReplyChannel.cs : use manual reset. * AspNetReplyChannel.cs : make it equivalent to the above. svn path=/trunk/mcs/; revision=157660 --- .../System.ServiceModel.Channels/AspNetReplyChannel.cs | 9 ++++----- .../System.ServiceModel.Channels/ChangeLog | 5 +++++ .../System.ServiceModel.Channels/HttpReplyChannel.cs | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/AspNetReplyChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/AspNetReplyChannel.cs index 8b083f5e984..572ef003348 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/AspNetReplyChannel.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/AspNetReplyChannel.cs @@ -41,7 +41,7 @@ namespace System.ServiceModel.Channels AspNetChannelListener listener; List waiting = new List (); HttpContext http_context; - AutoResetEvent wait; + ManualResetEvent wait; public AspNetReplyChannel (AspNetChannelListener 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; } diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog index 9b4c0e0f020..10cc62878ba 100755 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog @@ -1,3 +1,8 @@ +2010-05-21 Atsushi Enomoto + + * HttpReplyChannel.cs : use manual reset. + * AspNetReplyChannel.cs : make it equivalent to the above. + 2010-05-21 Atsushi Enomoto * HttpChannelListener.cs : do not accept more than one channel at a diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpReplyChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpReplyChannel.cs index 3cf3ec29891..933d726c113 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpReplyChannel.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpReplyChannel.cs @@ -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; -- 2.25.1