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
- XmlNamedNodeMap.cs
- XmlSchemaAny.cs
- OracleInternalConnection.cs
- IdentitySection.cs
- Panel.cs
- CodeSubDirectoriesCollection.cs
- NativeMethods.cs
- RegexGroupCollection.cs
- LinkTarget.cs
- MarkupExtensionParser.cs
- BidOverLoads.cs
- EventProxy.cs
- AnnotationResourceCollection.cs
- RegexCaptureCollection.cs
- PropertyOverridesDialog.cs
- FaultCode.cs
- StyleSheetDesigner.cs
- CombinedTcpChannel.cs
- WebHttpBindingElement.cs
- GetImportFileNameRequest.cs
- WebPartZoneBaseDesigner.cs
- OdbcConnectionString.cs
- TypedReference.cs
- AssociationSetEnd.cs
- Cursors.cs
- CompatibleIComparer.cs
- NegatedConstant.cs
- DbSourceParameterCollection.cs
- GeneratedContractType.cs
- Bezier.cs
- BitmapEncoder.cs
- TypeSource.cs
- ToolStripOverflowButton.cs
- ArithmeticException.cs
- TreeWalkHelper.cs
- SchemaMerger.cs
- xsdvalidator.cs
- _StreamFramer.cs
- FixedSOMElement.cs
- FramingChannels.cs
- BindingListCollectionView.cs
- ExpressionNode.cs
- GrammarBuilderPhrase.cs
- PerformanceCounter.cs
- WindowsHyperlink.cs
- TextRunTypographyProperties.cs
- CachedFontFace.cs
- TableLayoutRowStyleCollection.cs
- SQLDoubleStorage.cs
- XsltContext.cs
- StateMachineTimers.cs
- SecurityHelper.cs
- ProfessionalColors.cs
- StylusSystemGestureEventArgs.cs
- MdImport.cs
- ZipIOLocalFileBlock.cs
- LogEntryHeaderDeserializer.cs
- SafePipeHandle.cs
- ThaiBuddhistCalendar.cs
- DataGridViewToolTip.cs
- StreamWithDictionary.cs
- WebResourceAttribute.cs
- ScriptServiceAttribute.cs
- ApplicationFileCodeDomTreeGenerator.cs
- ServiceBehaviorElementCollection.cs
- SpeechRecognitionEngine.cs
- NotificationContext.cs
- TableLayoutRowStyleCollection.cs
- RequestCacheManager.cs
- ToggleProviderWrapper.cs
- OleDbPropertySetGuid.cs
- DetailsViewInsertedEventArgs.cs
- WmfPlaceableFileHeader.cs
- ToggleButton.cs
- ExceptionUtil.cs
- DesignTimeTemplateParser.cs
- webeventbuffer.cs
- RuntimeConfigurationRecord.cs
- FormCollection.cs
- SoapEnumAttribute.cs
- CryptoApi.cs
- DeviceSpecificChoiceCollection.cs
- PartialList.cs
- ThrowOnMultipleAssignment.cs
- XmlElement.cs
- NumericUpDown.cs
- MarkerProperties.cs
- NameValueCollection.cs
- WebConfigurationManager.cs
- ResourceExpression.cs
- Stylesheet.cs
- ArraySortHelper.cs
- NodeLabelEditEvent.cs
- _ConnectStream.cs
- SerialPinChanges.cs
- FixedElement.cs
- precedingquery.cs
- SettingsPropertyNotFoundException.cs
- ObjectQuery_EntitySqlExtensions.cs
- ADMembershipProvider.cs