Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Configuration / System / Configuration / SafeBitVector32.cs / 1 / SafeBitVector32.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Threading; namespace System.Configuration { // // This is a multithreadsafe version of System.Collections.Specialized.BitVector32. // [Serializable] internal struct SafeBitVector32 { private volatile int _data; internal SafeBitVector32(int data) { this._data = data; } #if UNUSED_CODE internal bool IsAnySet(int bitMask) { int data = _data; return (data & bitMask) != 0; } #endif internal bool this[int bit] { get { int data = _data; return (data & bit) == bit; } set { for (;;) { int oldData = _data; int newData; if (value) { newData = oldData | bit; } else { newData = oldData & ~bit; } #pragma warning disable 0420 int result = Interlocked.CompareExchange(ref _data, newData, oldData); #pragma warning restore 0420 if (result == oldData) { break; } } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Threading; namespace System.Configuration { // // This is a multithreadsafe version of System.Collections.Specialized.BitVector32. // [Serializable] internal struct SafeBitVector32 { private volatile int _data; internal SafeBitVector32(int data) { this._data = data; } #if UNUSED_CODE internal bool IsAnySet(int bitMask) { int data = _data; return (data & bitMask) != 0; } #endif internal bool this[int bit] { get { int data = _data; return (data & bit) == bit; } set { for (;;) { int oldData = _data; int newData; if (value) { newData = oldData | bit; } else { newData = oldData & ~bit; } #pragma warning disable 0420 int result = Interlocked.CompareExchange(ref _data, newData, oldData); #pragma warning restore 0420 if (result == oldData) { break; } } } } } } // 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
- XmlDataDocument.cs
- PropertyInformationCollection.cs
- __ConsoleStream.cs
- RelatedCurrencyManager.cs
- TraversalRequest.cs
- SubclassTypeValidatorAttribute.cs
- DefaultProxySection.cs
- FileLogRecordHeader.cs
- OracleDateTime.cs
- SvcMapFileSerializer.cs
- GeometryGroup.cs
- Size3DConverter.cs
- WizardPanelChangingEventArgs.cs
- SynchronizingStream.cs
- SQLInt64Storage.cs
- CompModSwitches.cs
- IndexerNameAttribute.cs
- DataGridBeginningEditEventArgs.cs
- SafeRightsManagementEnvironmentHandle.cs
- CryptoApi.cs
- PointAnimationUsingKeyFrames.cs
- CatalogPartChrome.cs
- CatalogZoneBase.cs
- WindowInteractionStateTracker.cs
- MonthCalendar.cs
- GuidelineCollection.cs
- SharedPerformanceCounter.cs
- FixedDocument.cs
- CngProvider.cs
- WebRequest.cs
- ToolTipService.cs
- ClientScriptManager.cs
- ModifiableIteratorCollection.cs
- RequiredFieldValidator.cs
- TextLineResult.cs
- ClientRuntimeConfig.cs
- BitmapMetadataBlob.cs
- ResourceManagerWrapper.cs
- BitmapImage.cs
- oledbmetadatacollectionnames.cs
- InvokeHandlers.cs
- BitHelper.cs
- DrawingGroupDrawingContext.cs
- Quad.cs
- ModelItemDictionary.cs
- X509SecurityToken.cs
- HttpProtocolImporter.cs
- connectionpool.cs
- PersistChildrenAttribute.cs
- ToolStripHighContrastRenderer.cs
- ArcSegment.cs
- DataGridViewCellParsingEventArgs.cs
- StateDesignerConnector.cs
- EventLog.cs
- SelectionChangedEventArgs.cs
- TypedDatasetGenerator.cs
- InvalidTimeZoneException.cs
- LongTypeConverter.cs
- OdbcConnectionOpen.cs
- DataSourceConverter.cs
- DeviceContext.cs
- RepeatButtonAutomationPeer.cs
- SQLInt64.cs
- Base64WriteStateInfo.cs
- RsaSecurityTokenParameters.cs
- FigureParagraph.cs
- HMACMD5.cs
- PackageDigitalSignatureManager.cs
- FrameworkPropertyMetadata.cs
- BuildProviderUtils.cs
- TemplateXamlParser.cs
- ComponentSerializationService.cs
- CompressStream.cs
- SendActivityEventArgs.cs
- SymbolDocumentGenerator.cs
- EntityDescriptor.cs
- XmlDataSourceNodeDescriptor.cs
- DataGridCellsPanel.cs
- BinaryObjectInfo.cs
- QueueProcessor.cs
- PixelFormat.cs
- InfoCardBinaryReader.cs
- BitmapFrameEncode.cs
- CommandHelpers.cs
- Sql8ExpressionRewriter.cs
- PathGradientBrush.cs
- X509Utils.cs
- ExpressionBindingCollection.cs
- PartialCachingAttribute.cs
- ReadOnlyAttribute.cs
- RadioButton.cs
- ToolTipService.cs
- FileEnumerator.cs
- TextAdaptor.cs
- SqlDataSourceView.cs
- UIPropertyMetadata.cs
- SystemIPGlobalStatistics.cs
- ListItemParagraph.cs
- TableStyle.cs
- ConfigXmlCDataSection.cs