X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem.Web.Services%2FSystem.Web.Services.Protocols%2FWebClientAsyncResult.cs;h=cda505e5e6a4bfda61061f9e6bc8cf92715a3d66;hb=a57c3b9782ca02e4f060ac37dac5b2a20f16772a;hp=476f87ac6170677e6decaff03e5fb6732472affb;hpb=89d0ba3968d36576553e0f483b0c69465f94e8ae;p=mono.git diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebClientAsyncResult.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebClientAsyncResult.cs index 476f87ac617..cda505e5e6a 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebClientAsyncResult.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebClientAsyncResult.cs @@ -1,12 +1,12 @@ -// -// System.Web.Services.Protocols.WebClientAsyncResult.cs -// -// Author: -// Tim Coleman (tim@timcoleman.com) -// Lluis Sanchez Gual (lluis@ximian.com) -// -// Copyright (C) Tim Coleman, 2002 -// +// +// System.Web.Services.Protocols.WebClientAsyncResult.cs +// +// Author: +// Tim Coleman (tim@timcoleman.com) +// Lluis Sanchez Gual (lluis@ximian.com) +// +// Copyright (C) Tim Coleman, 2002 +// // // Permission is hereby granted, free of charge, to any person obtaining @@ -28,98 +28,98 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // - -using System.Net; -using System.Threading; - -namespace System.Web.Services.Protocols { - public class WebClientAsyncResult : IAsyncResult { - - #region Fields - - AsyncCallback _callback; - object _asyncState; - - bool _completedSynchronously; - bool _done; - ManualResetEvent _waitHandle; - - internal object Result; - internal Exception Exception; - internal WebRequest Request; - - #endregion // Fields - - #region Constructors - - internal WebClientAsyncResult (WebRequest request, AsyncCallback callback, object asyncState) - { - _callback = callback; - Request = request; - _asyncState = asyncState; - } - - #endregion // Constructors - - #region Properties - - public object AsyncState { - get { return _asyncState; } - } - - public WaitHandle AsyncWaitHandle - { - get - { - lock (this) { - if (_waitHandle != null) return _waitHandle; - _waitHandle = new ManualResetEvent (_done); - return _waitHandle; - } - } - } - - public bool CompletedSynchronously - { - get { return _completedSynchronously; } - } - - public bool IsCompleted - { - get { lock (this) { return _done; } } - } - - #endregion // Properties - - #region Methods - - public void Abort () - { - Request.Abort (); - } - - internal void SetCompleted (object result, Exception exception, bool async) - { - lock (this) - { - Exception = exception; - Result = result; - _done = true; - _completedSynchronously = async; - if (_waitHandle != null) _waitHandle.Set (); - Monitor.PulseAll (this); - } - if (_callback != null) _callback (this); - } - - internal void WaitForComplete () - { - lock (this) - { - Monitor.Wait (this); - } - } - - #endregion // Methods - } + +using System.Net; +using System.Threading; + +namespace System.Web.Services.Protocols { + public class WebClientAsyncResult : IAsyncResult { + + #region Fields + + AsyncCallback _callback; + object _asyncState; + + bool _completedSynchronously; + bool _done; + ManualResetEvent _waitHandle; + + internal object Result; + internal Exception Exception; + internal WebRequest Request; + + #endregion // Fields + + #region Constructors + + internal WebClientAsyncResult (WebRequest request, AsyncCallback callback, object asyncState) + { + _callback = callback; + Request = request; + _asyncState = asyncState; + } + + #endregion // Constructors + + #region Properties + + public object AsyncState { + get { return _asyncState; } + } + + public WaitHandle AsyncWaitHandle + { + get + { + lock (this) { + if (_waitHandle != null) return _waitHandle; + _waitHandle = new ManualResetEvent (_done); + return _waitHandle; + } + } + } + + public bool CompletedSynchronously + { + get { return _completedSynchronously; } + } + + public bool IsCompleted + { + get { lock (this) { return _done; } } + } + + #endregion // Properties + + #region Methods + + public void Abort () + { + Request.Abort (); + } + + internal void SetCompleted (object result, Exception exception, bool async) + { + lock (this) + { + Exception = exception; + Result = result; + _done = true; + _completedSynchronously = async; + if (_waitHandle != null) _waitHandle.Set (); + Monitor.PulseAll (this); + } + if (_callback != null) _callback (this); + } + + internal void WaitForComplete () + { + lock (this) + { + Monitor.Wait (this); + } + } + + #endregion // Methods + } }