Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- TemplateField.cs
- EndpointBehaviorElementCollection.cs
- DataGridViewSortCompareEventArgs.cs
- PropertyEntry.cs
- StylusPlugInCollection.cs
- Property.cs
- Debugger.cs
- TypeContext.cs
- Rights.cs
- WMIInterop.cs
- DiscardableAttribute.cs
- TraceSection.cs
- ThreadStartException.cs
- ContentElement.cs
- DbLambda.cs
- ImportContext.cs
- PropertyCondition.cs
- ListViewDataItem.cs
- OpenFileDialog.cs
- SimpleTypeResolver.cs
- ContentIterators.cs
- StaticSiteMapProvider.cs
- MobileUserControlDesigner.cs
- CreateRefExpr.cs
- ToolStripContentPanelRenderEventArgs.cs
- ValidateNames.cs
- WindowsComboBox.cs
- ApplyImportsAction.cs
- MenuItemAutomationPeer.cs
- XmlReflectionMember.cs
- processwaithandle.cs
- DependencyPropertyAttribute.cs
- ThemeableAttribute.cs
- ResourceType.cs
- Accessors.cs
- XmlChildNodes.cs
- Pair.cs
- OdbcDataAdapter.cs
- DBDataPermission.cs
- TdsValueSetter.cs
- BitmapImage.cs
- DesignTimeVisibleAttribute.cs
- NullRuntimeConfig.cs
- Decimal.cs
- DoubleLinkList.cs
- ExpressionPrinter.cs
- ComponentCollection.cs
- GroupQuery.cs
- SwitchLevelAttribute.cs
- xdrvalidator.cs
- ContentOperations.cs
- EntityViewContainer.cs
- ToolStripLocationCancelEventArgs.cs
- Itemizer.cs
- ContentDisposition.cs
- ListCardsInFileRequest.cs
- ReadContentAsBinaryHelper.cs
- SimpleRecyclingCache.cs
- AnimationTimeline.cs
- ServiceNameElement.cs
- DataExpression.cs
- CompilerResults.cs
- LinkLabelLinkClickedEvent.cs
- MessageBox.cs
- MsmqBindingMonitor.cs
- DebugView.cs
- TextDecorationCollection.cs
- CodeChecksumPragma.cs
- SimpleBitVector32.cs
- IPGlobalProperties.cs
- ImageSourceConverter.cs
- ArraySet.cs
- DiscoveryReference.cs
- StrokeDescriptor.cs
- BmpBitmapDecoder.cs
- XPathItem.cs
- MaskDescriptor.cs
- IncrementalReadDecoders.cs
- ToolStripContentPanelRenderEventArgs.cs
- DropShadowBitmapEffect.cs
- EventProxy.cs
- ExpressionLink.cs
- LoadWorkflowAsyncResult.cs
- ClearTypeHintValidation.cs
- ConnectionPointCookie.cs
- WorkflowOperationAsyncResult.cs
- Utilities.cs
- IndentedWriter.cs
- Vertex.cs
- EdmSchemaError.cs
- EncryptedData.cs
- TimeoutHelper.cs
- SafeFileHandle.cs
- IndexedGlyphRun.cs
- SecurityTokenSerializer.cs
- FormViewCommandEventArgs.cs
- TypeSemantics.cs
- ParameterBuilder.cs
- TabPanel.cs
- MetaChildrenColumn.cs