AspNetChannelListener<IReplyChannel> listener;
List<HttpContext> waiting = new List<HttpContext> ();
HttpContext http_context;
- AutoResetEvent wait;
+ ManualResetEvent wait;
public AspNetReplyChannel (AspNetChannelListener<IReplyChannel> listener)
: base (listener)
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;
}
+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
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;