Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Metadata / ObjectLayer / LockedAssemblyCache.cs / 1305376 / LockedAssemblyCache.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Threading; namespace System.Data.Metadata.Edm { internal class LockedAssemblyCache : IDisposable { private object _lockObject; private Dictionary_globalAssemblyCache; internal LockedAssemblyCache(object lockObject, Dictionary globalAssemblyCache) { _lockObject = lockObject; _globalAssemblyCache = globalAssemblyCache; #pragma warning disable 0618 //@ Monitor.Enter(_lockObject); #pragma warning restore 0618 } public void Dispose() { // Technically, calling GC.SuppressFinalize is not required because the class does not // have a finalizer, but it does no harm, protects against the case where a finalizer is added // in the future, and prevents an FxCop warning. GC.SuppressFinalize(this); Monitor.Exit(_lockObject); _lockObject = null; _globalAssemblyCache = null; } [Conditional("DEBUG")] private void AssertLockedByThisThread() { bool entered = false; Monitor.TryEnter(_lockObject, ref entered); if (entered) { Monitor.Exit(_lockObject); } Debug.Assert(entered, "The cache is being accessed by a thread that isn't holding the lock"); } internal bool TryGetValue(Assembly assembly, out ImmutableAssemblyCacheEntry cacheEntry) { AssertLockedByThisThread(); return _globalAssemblyCache.TryGetValue(assembly, out cacheEntry); } internal void Add(Assembly assembly, ImmutableAssemblyCacheEntry assemblyCacheEntry) { AssertLockedByThisThread(); _globalAssemblyCache.Add(assembly, assemblyCacheEntry); } internal void Clear() { AssertLockedByThisThread(); _globalAssemblyCache.Clear(); } } } // 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
- WebPart.cs
- TextTreeInsertUndoUnit.cs
- ParamArrayAttribute.cs
- ApplicationInterop.cs
- counter.cs
- FaultDesigner.cs
- ObjectQueryState.cs
- ExpressionWriter.cs
- EntityDataSourceContextCreatedEventArgs.cs
- SerialPort.cs
- AsnEncodedData.cs
- ObjectQuery.cs
- FolderLevelBuildProvider.cs
- ObjectParameter.cs
- EtwTrace.cs
- EdgeProfileValidation.cs
- metadatamappinghashervisitor.cs
- SamlAuthenticationStatement.cs
- LineSegment.cs
- GridEntryCollection.cs
- SafeArrayRankMismatchException.cs
- Socket.cs
- WebPartsPersonalizationAuthorization.cs
- RegexRunner.cs
- CalloutQueueItem.cs
- PeerNameRegistration.cs
- ServerValidateEventArgs.cs
- CurrencyManager.cs
- PropertyOverridesDialog.cs
- BindingBase.cs
- TCPClient.cs
- input.cs
- SqlEnums.cs
- PointValueSerializer.cs
- XmlSchemaDatatype.cs
- ClientUrlResolverWrapper.cs
- Message.cs
- PropertyValueChangedEvent.cs
- IProducerConsumerCollection.cs
- DayRenderEvent.cs
- CharEntityEncoderFallback.cs
- TextServicesContext.cs
- IndexOutOfRangeException.cs
- BitmapEffectrendercontext.cs
- TextBoxRenderer.cs
- HtmlInputHidden.cs
- ConnectionPoolManager.cs
- QilSortKey.cs
- Solver.cs
- BaseDataListComponentEditor.cs
- DataGridPreparingCellForEditEventArgs.cs
- CompilationUtil.cs
- hwndwrapper.cs
- DataRecordInfo.cs
- DataGridViewAdvancedBorderStyle.cs
- OdbcException.cs
- TableCellAutomationPeer.cs
- ObjectParameter.cs
- MostlySingletonList.cs
- ScrollEvent.cs
- WebServiceReceiveDesigner.cs
- ImageListDesigner.cs
- XPathAncestorIterator.cs
- TemplateBindingExtensionConverter.cs
- RoamingStoreFileUtility.cs
- Normalization.cs
- ErrorRuntimeConfig.cs
- WebBrowserUriTypeConverter.cs
- NamedPipeWorkerProcess.cs
- StretchValidation.cs
- ParserStreamGeometryContext.cs
- DropShadowBitmapEffect.cs
- SerializationStore.cs
- NotifyInputEventArgs.cs
- PopupRoot.cs
- SparseMemoryStream.cs
- AnimationClockResource.cs
- TextTreeObjectNode.cs
- SessionEndedEventArgs.cs
- Int16AnimationBase.cs
- TemplateKey.cs
- SQLBytes.cs
- RowTypeElement.cs
- WebPageTraceListener.cs
- TranslateTransform.cs
- DataGridColumnStyleMappingNameEditor.cs
- ParserOptions.cs
- EntityDataSourceWrapper.cs
- ResumeStoryboard.cs
- XmlnsCache.cs
- ModifierKeysConverter.cs
- PackageRelationshipSelector.cs
- DropTarget.cs
- TemplateControl.cs
- x509store.cs
- UrlMappingsSection.cs
- EmissiveMaterial.cs
- XmlSchemaType.cs
- OpenTypeLayout.cs
- SmtpNetworkElement.cs