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
- ReadOnlyDataSource.cs
- DataGridViewSelectedColumnCollection.cs
- FlowDocumentScrollViewer.cs
- COM2EnumConverter.cs
- CodeTypeDeclarationCollection.cs
- ContentWrapperAttribute.cs
- GestureRecognitionResult.cs
- ListBoxItemWrapperAutomationPeer.cs
- StorageMappingItemLoader.cs
- FontStyleConverter.cs
- MTConfigUtil.cs
- WaitHandle.cs
- DecimalConstantAttribute.cs
- IriParsingElement.cs
- SimpleFieldTemplateUserControl.cs
- ListViewCancelEventArgs.cs
- Int32Rect.cs
- ThaiBuddhistCalendar.cs
- Console.cs
- ProtocolViolationException.cs
- HwndTarget.cs
- MessageQueueException.cs
- OracleSqlParser.cs
- X509Extension.cs
- ModelPropertyImpl.cs
- HandleCollector.cs
- HtmlTableCell.cs
- Tokenizer.cs
- XmlTextReader.cs
- TypedTableHandler.cs
- BuildManagerHost.cs
- ObjectReaderCompiler.cs
- QuaternionAnimationUsingKeyFrames.cs
- SystemMulticastIPAddressInformation.cs
- Int16Animation.cs
- DtdParser.cs
- BoundsDrawingContextWalker.cs
- ImageField.cs
- Validator.cs
- SqlDataSourceCustomCommandPanel.cs
- WCFModelStrings.Designer.cs
- COM2PictureConverter.cs
- StreamedFramingRequestChannel.cs
- BodyWriter.cs
- PageThemeParser.cs
- ObjectResult.cs
- HtmlInputFile.cs
- StreamUpdate.cs
- BoundPropertyEntry.cs
- ServiceTimeoutsElement.cs
- COAUTHIDENTITY.cs
- MarshalByRefObject.cs
- XmlChildNodes.cs
- HttpCachePolicy.cs
- XmlText.cs
- RewritingSimplifier.cs
- XmlByteStreamWriter.cs
- BufferedStream2.cs
- EventWaitHandleSecurity.cs
- ResourceManagerWrapper.cs
- HttpResponseHeader.cs
- UnsafeNativeMethods.cs
- LabelDesigner.cs
- StorageFunctionMapping.cs
- CardSpacePolicyElement.cs
- BrowserTree.cs
- ActiveXHelper.cs
- WebPartTracker.cs
- CustomAttributeBuilder.cs
- TokenFactoryFactory.cs
- _SslState.cs
- DataRelation.cs
- TransformerConfigurationWizardBase.cs
- SqlUdtInfo.cs
- EdgeModeValidation.cs
- TemplatePropertyEntry.cs
- DataServiceRequestArgs.cs
- BackgroundWorker.cs
- NameTable.cs
- CreateUserWizardStep.cs
- DataGridViewCellCollection.cs
- ItemCollection.cs
- ConfigurationFileMap.cs
- EditorPartDesigner.cs
- TrustManager.cs
- EntityTypeEmitter.cs
- OleDbRowUpdatedEvent.cs
- PackageProperties.cs
- Operand.cs
- EnvelopeVersion.cs
- PopupControlService.cs
- EmptyStringExpandableObjectConverter.cs
- StringAnimationUsingKeyFrames.cs
- WhitespaceSignificantCollectionAttribute.cs
- DataGridViewRow.cs
- ResourceExpressionBuilder.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- CollectionContainer.cs
- PropertyTab.cs
- ZoneButton.cs