Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / xsp / System / Web / Util / SafeBitVector32.cs / 1 / SafeBitVector32.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Threading; namespace System.Web.Util { // // 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 int IntegerValue { get { return _data; } set { #pragma warning disable 0420 Interlocked.Exchange(ref _data, value); #pragma warning restore 0420 } } #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; } } } } internal bool ChangeValue(int bit, bool value) { for (;;) { int oldData = _data; int newData; if (value) { newData = oldData | bit; } else { newData = oldData & ~bit; } if (oldData == newData) { return false; } #pragma warning disable 0420 int result = Interlocked.CompareExchange(ref _data, newData, oldData); #pragma warning restore 0420 if (result == oldData) { return true; } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ViewPort3D.cs
- EntitySetBase.cs
- DomNameTable.cs
- SelectionProcessor.cs
- NonParentingControl.cs
- XmlAttributeOverrides.cs
- XhtmlCssHandler.cs
- FunctionNode.cs
- SourceLineInfo.cs
- CuspData.cs
- DataGridViewCellStateChangedEventArgs.cs
- EdmToObjectNamespaceMap.cs
- WindowsPen.cs
- ReferenceConverter.cs
- ExpressionBindingsDialog.cs
- _Semaphore.cs
- CheckBoxAutomationPeer.cs
- Codec.cs
- Attributes.cs
- Light.cs
- SelectionPattern.cs
- ControlType.cs
- BitArray.cs
- ReaderOutput.cs
- NavigationProperty.cs
- TimeSpanSecondsConverter.cs
- TextTreeInsertUndoUnit.cs
- Matrix3DConverter.cs
- DebugHandleTracker.cs
- ManagementBaseObject.cs
- ArrangedElementCollection.cs
- HttpListenerContext.cs
- TemplateField.cs
- GridViewUpdatedEventArgs.cs
- XmlDownloadManager.cs
- MouseGestureValueSerializer.cs
- CompiledQuery.cs
- Literal.cs
- TextureBrush.cs
- MetadataSource.cs
- SqlTopReducer.cs
- PermissionSetEnumerator.cs
- SerTrace.cs
- ListViewItem.cs
- ValidationVisibilityAttribute.cs
- ColorDialog.cs
- ValueType.cs
- DotNetATv1WindowsLogEntryDeserializer.cs
- ListDictionaryInternal.cs
- CapacityStreamGeometryContext.cs
- EventManager.cs
- ToolZoneDesigner.cs
- CalendarDataBindingHandler.cs
- IxmlLineInfo.cs
- COM2ColorConverter.cs
- SessionStateUtil.cs
- SequentialOutput.cs
- ClientTarget.cs
- HtmlTitle.cs
- InlinedAggregationOperatorEnumerator.cs
- CodeGenerator.cs
- ProvideValueServiceProvider.cs
- AccessControlList.cs
- SelfIssuedAuthAsymmetricKey.cs
- ResourcesChangeInfo.cs
- TokenFactoryCredential.cs
- NullableDoubleMinMaxAggregationOperator.cs
- ProtectedConfigurationProviderCollection.cs
- MutexSecurity.cs
- ExternalException.cs
- WindowsGraphicsWrapper.cs
- HwndSourceKeyboardInputSite.cs
- SQLDoubleStorage.cs
- NamedElement.cs
- CollectionChangedEventManager.cs
- UnionCodeGroup.cs
- XmlSecureResolver.cs
- ItemsChangedEventArgs.cs
- TriggerActionCollection.cs
- CommonDialog.cs
- EnumMemberAttribute.cs
- AutomationElement.cs
- FixedSOMLineRanges.cs
- SrgsSemanticInterpretationTag.cs
- PngBitmapDecoder.cs
- CheckPair.cs
- InkCanvas.cs
- OutputCacheSettingsSection.cs
- X509CertificateClaimSet.cs
- BrowserCapabilitiesCompiler.cs
- TraceContextEventArgs.cs
- ResourcePool.cs
- ServiceBehaviorElement.cs
- dtdvalidator.cs
- SID.cs
- PathFigure.cs
- EntityDesignPluralizationHandler.cs
- ApplicationException.cs
- FloatSumAggregationOperator.cs
- InfoCardTraceRecord.cs