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
- DirectoryObjectSecurity.cs
- UnsafeNativeMethods.cs
- PeerInvitationResponse.cs
- ZoneButton.cs
- DataRowView.cs
- EventHandlerList.cs
- LocationSectionRecord.cs
- _SslSessionsCache.cs
- CompiledQueryCacheEntry.cs
- SystemWebCachingSectionGroup.cs
- Rotation3DKeyFrameCollection.cs
- XmlNamedNodeMap.cs
- SetIterators.cs
- ExtensionWindowHeader.cs
- WebPartCatalogCloseVerb.cs
- CommonDialog.cs
- CatalogZoneBase.cs
- ToolStripRenderer.cs
- AppDomainFactory.cs
- GridLengthConverter.cs
- EditingScope.cs
- ThreadStartException.cs
- XmlC14NWriter.cs
- CalendarDesigner.cs
- AnnotationDocumentPaginator.cs
- SerializationSectionGroup.cs
- DatagramAdapter.cs
- ControlBuilder.cs
- FlowDocumentPageViewerAutomationPeer.cs
- WpfKnownType.cs
- WebPartDescription.cs
- LiteralSubsegment.cs
- CellIdBoolean.cs
- GlyphInfoList.cs
- StringOutput.cs
- XmlSchemaAll.cs
- BindableAttribute.cs
- AppLevelCompilationSectionCache.cs
- BinaryConverter.cs
- IPPacketInformation.cs
- PropertyDescriptor.cs
- RegistrationServices.cs
- TimeSpanSecondsConverter.cs
- EnvelopedSignatureTransform.cs
- ShaderRenderModeValidation.cs
- ObjectSecurity.cs
- SQLConvert.cs
- DesignerAttribute.cs
- SqlFunctionAttribute.cs
- FilteredXmlReader.cs
- SafeLibraryHandle.cs
- PlatformCulture.cs
- SafeHandle.cs
- PeerNode.cs
- UpDownEvent.cs
- SoapParser.cs
- MailWebEventProvider.cs
- InputChannel.cs
- TableItemStyle.cs
- BitmapMetadataEnumerator.cs
- MutexSecurity.cs
- AlternateViewCollection.cs
- WebPartManagerInternals.cs
- Polygon.cs
- CompiledQueryCacheEntry.cs
- WorkflowDurableInstance.cs
- KeyConverter.cs
- ReadOnlyDictionary.cs
- QilVisitor.cs
- DataPagerFieldCollection.cs
- SymbolDocumentGenerator.cs
- WpfXamlType.cs
- CompletionCallbackWrapper.cs
- EnvelopeVersion.cs
- ApplicationDirectoryMembershipCondition.cs
- WebPartMenu.cs
- XmlDocumentType.cs
- WinFormsComponentEditor.cs
- ValueQuery.cs
- AttributeCollection.cs
- ZipFileInfo.cs
- ToolStripPanelRenderEventArgs.cs
- ProtocolElement.cs
- SystemNetworkInterface.cs
- ChildChangedEventArgs.cs
- AnnotationObservableCollection.cs
- mediaeventargs.cs
- AddInControllerImpl.cs
- WorkflowDesignerColors.cs
- StylusOverProperty.cs
- HtmlTextArea.cs
- InvalidOperationException.cs
- MediaElement.cs
- XmlElementAttribute.cs
- XmlLanguageConverter.cs
- Line.cs
- PageSettings.cs
- TraceEventCache.cs
- BitmapCodecInfo.cs
- StylusPointProperty.cs