Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / ManagedLibraries / Remoting / Channels / CORE / BasicAsyncResult.cs / 1305376 / BasicAsyncResult.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** File: BasicAsyncResult.cs ** ** Purpose: Base class for async result implementations. ** ** Date: Oct 21, 2001 ** ===========================================================*/ using System; using System.Threading; namespace System.Runtime.Remoting.Channels { internal class BasicAsyncResult : IAsyncResult { private AsyncCallback _asyncCallback; private Object _asyncState; private Object _returnValue; private Exception _exception; private bool _bIsComplete; private ManualResetEvent _manualResetEvent; internal BasicAsyncResult(AsyncCallback callback, Object state) { _asyncCallback = callback; _asyncState = state; } // BasicAsyncResult public Object AsyncState { get { return _asyncState; } } // AsyncState public WaitHandle AsyncWaitHandle { get { bool bSavedIsComplete = _bIsComplete; if (_manualResetEvent == null) { lock (this) { if (_manualResetEvent == null) { _manualResetEvent = new ManualResetEvent(bSavedIsComplete); } } } if (!bSavedIsComplete && _bIsComplete) _manualResetEvent.Set(); return (WaitHandle)_manualResetEvent; } } // AsyncWaitHandle public bool CompletedSynchronously { get { return false; } } // CompletedSynchronously public bool IsCompleted { get { return _bIsComplete; } } // IsCompleted internal Exception Exception { get { return _exception; } } internal void SetComplete(Object returnValue, Exception exception) { _returnValue = returnValue; _exception = exception; CleanupOnComplete(); _bIsComplete = true; try { if (_manualResetEvent != null) _manualResetEvent.Set(); } catch (Exception e) { if (_exception == null) _exception = e; } // invoke the callback if (_asyncCallback != null) _asyncCallback(this); } // SetComplete internal virtual void CleanupOnComplete() { } } // BasicAsyncResult } // namespace System.Runtime.Remoting.Channels // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WindowsRichEditRange.cs
- AggregateNode.cs
- ThreadPool.cs
- Inflater.cs
- ConfigurationPermission.cs
- Dictionary.cs
- BufferAllocator.cs
- FlowLayoutPanel.cs
- SoapAttributeAttribute.cs
- SortKey.cs
- CheckableControlBaseAdapter.cs
- RelationshipEndMember.cs
- VScrollProperties.cs
- DecoderReplacementFallback.cs
- ProxyWebPart.cs
- TextBox.cs
- InertiaRotationBehavior.cs
- Int64Animation.cs
- PermissionSetTriple.cs
- SqlServer2KCompatibilityAnnotation.cs
- WebPartEditorCancelVerb.cs
- SqlInternalConnection.cs
- SqlXmlStorage.cs
- DecimalKeyFrameCollection.cs
- XmlObjectSerializerReadContextComplex.cs
- bidPrivateBase.cs
- XmlHierarchicalEnumerable.cs
- Decimal.cs
- ControlIdConverter.cs
- CfgArc.cs
- NavigationCommands.cs
- FileLoadException.cs
- TraceContext.cs
- ConfigurationManager.cs
- DbSetClause.cs
- AesCryptoServiceProvider.cs
- ErrorReporting.cs
- HtmlTableRow.cs
- Visual3DCollection.cs
- SQLDouble.cs
- RemoteWebConfigurationHostStream.cs
- HitTestParameters3D.cs
- bidPrivateBase.cs
- Base64Stream.cs
- ETagAttribute.cs
- CalendarDay.cs
- RegexTree.cs
- DataViewListener.cs
- SingleResultAttribute.cs
- DataServiceProviderWrapper.cs
- BindingSource.cs
- DataGridHeaderBorder.cs
- NativeMethods.cs
- Query.cs
- SQLGuidStorage.cs
- StateRuntime.cs
- EmptyElement.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- DependencyPropertyValueSerializer.cs
- PersonalizationAdministration.cs
- XmlSchemaAny.cs
- DataExpression.cs
- OwnerDrawPropertyBag.cs
- ExponentialEase.cs
- WebPartVerbCollection.cs
- RootBrowserWindowAutomationPeer.cs
- SqlFlattener.cs
- ToolBar.cs
- HttpGetClientProtocol.cs
- FixedSOMSemanticBox.cs
- ButtonBaseAdapter.cs
- TearOffProxy.cs
- StreamWriter.cs
- PropertyNames.cs
- StrokeCollectionConverter.cs
- DataListItem.cs
- WebPartDisplayModeCancelEventArgs.cs
- DropTarget.cs
- PageEventArgs.cs
- StructuredCompositeActivityDesigner.cs
- PersonalizablePropertyEntry.cs
- ChannelSinkStacks.cs
- validation.cs
- filewebresponse.cs
- DropShadowEffect.cs
- RuleSettingsCollection.cs
- __Filters.cs
- XmlUrlResolver.cs
- PeerCollaborationPermission.cs
- MouseActionConverter.cs
- SourceFileInfo.cs
- UnknownBitmapDecoder.cs
- Parser.cs
- DocumentViewerHelper.cs
- XmlRawWriterWrapper.cs
- BooleanSwitch.cs
- WorkflowPageSetupDialog.cs
- Visual.cs
- ConfigurationErrorsException.cs
- WebPartConnectionsCloseVerb.cs