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
- ping.cs
- DataGridViewColumnConverter.cs
- FileUtil.cs
- SqlException.cs
- PenContext.cs
- ValidatorCompatibilityHelper.cs
- XmlCharCheckingReader.cs
- COM2ComponentEditor.cs
- ValueSerializer.cs
- WebPartDisplayModeCancelEventArgs.cs
- RenderData.cs
- Point3D.cs
- RuntimeArgumentHandle.cs
- DataObject.cs
- BaseProcessor.cs
- StrokeNode.cs
- EntityTypeEmitter.cs
- StructuralComparisons.cs
- WebServiceTypeData.cs
- BypassElement.cs
- RedirectionProxy.cs
- HttpDebugHandler.cs
- Underline.cs
- VersionPair.cs
- BaseCodeDomTreeGenerator.cs
- SubstitutionResponseElement.cs
- HtmlTableCellCollection.cs
- StorageScalarPropertyMapping.cs
- PathFigure.cs
- ClientConfigurationSystem.cs
- SharedPerformanceCounter.cs
- CryptoApi.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- ResourceProperty.cs
- DataGridColumnHeadersPresenter.cs
- DataGridSortCommandEventArgs.cs
- SpeakInfo.cs
- UnionCqlBlock.cs
- COM2TypeInfoProcessor.cs
- ContextMenuAutomationPeer.cs
- CodeAttributeArgumentCollection.cs
- RequestDescription.cs
- DBParameter.cs
- CorrelationQuery.cs
- RuntimeWrappedException.cs
- SelectionItemPattern.cs
- XmlSchemaElement.cs
- GeneralTransform2DTo3D.cs
- ToolStripItemEventArgs.cs
- Send.cs
- SettingsContext.cs
- WebMethodAttribute.cs
- DataGridViewLinkCell.cs
- Rijndael.cs
- Camera.cs
- TrackBarRenderer.cs
- SafePointer.cs
- SqlClientWrapperSmiStream.cs
- TableLayoutPanel.cs
- Directory.cs
- ArrayWithOffset.cs
- KnownBoxes.cs
- FormClosingEvent.cs
- Pkcs7Recipient.cs
- TypeUtil.cs
- IDispatchConstantAttribute.cs
- TypeToken.cs
- Imaging.cs
- HasCopySemanticsAttribute.cs
- LinqDataSourceInsertEventArgs.cs
- AssemblyAttributesGoHere.cs
- FontFamilyIdentifier.cs
- DataContext.cs
- DataGridViewRowsRemovedEventArgs.cs
- KerberosSecurityTokenAuthenticator.cs
- SatelliteContractVersionAttribute.cs
- WebPartMenuStyle.cs
- MetadataItemEmitter.cs
- Label.cs
- EventLogPermissionEntryCollection.cs
- WbemProvider.cs
- HandlerWithFactory.cs
- StrongNameUtility.cs
- HttpRequestBase.cs
- Sequence.cs
- TextElementCollectionHelper.cs
- ListItemCollection.cs
- BinaryFormatter.cs
- TextEditorContextMenu.cs
- ProbeDuplexCD1AsyncResult.cs
- TimeoutException.cs
- ToolStripKeyboardHandlingService.cs
- KeyTimeConverter.cs
- WebPartAddingEventArgs.cs
- EncoderParameters.cs
- ToolStripItemImageRenderEventArgs.cs
- SystemException.cs
- ContextBase.cs
- ClonableStack.cs
- SineEase.cs