Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Util / SafeBitVector32.cs / 1305376 / 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; } 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WorkflowValidationFailedException.cs
- GenericTextProperties.cs
- BaseCodeDomTreeGenerator.cs
- AssertSection.cs
- DataObjectMethodAttribute.cs
- FixedSOMElement.cs
- DelegatingChannelListener.cs
- EdmEntityTypeAttribute.cs
- MappingSource.cs
- InputScopeAttribute.cs
- ClickablePoint.cs
- ISFClipboardData.cs
- SqlNode.cs
- RangeValuePatternIdentifiers.cs
- Soap11ServerProtocol.cs
- EdmComplexPropertyAttribute.cs
- ValidatorCompatibilityHelper.cs
- XmlTextAttribute.cs
- ArraySet.cs
- Lasso.cs
- RawStylusInputReport.cs
- DataSet.cs
- GraphicsContext.cs
- PathGradientBrush.cs
- ConnectorSelectionGlyph.cs
- MILUtilities.cs
- HierarchicalDataSourceControl.cs
- AssertUtility.cs
- BlurEffect.cs
- ProcessHostServerConfig.cs
- NameValuePermission.cs
- GuidConverter.cs
- DataSourceGeneratorException.cs
- ManipulationVelocities.cs
- LineSegment.cs
- XmlSchemaSimpleTypeRestriction.cs
- remotingproxy.cs
- Debugger.cs
- BitmapEffectDrawing.cs
- OdbcFactory.cs
- StandardOleMarshalObject.cs
- DataFormat.cs
- Solver.cs
- FileAuthorizationModule.cs
- ValueSerializerAttribute.cs
- DispatcherTimer.cs
- IPEndPoint.cs
- XmlSchemaAnyAttribute.cs
- SpeechDetectedEventArgs.cs
- SqlClientWrapperSmiStreamChars.cs
- GridViewDeleteEventArgs.cs
- ClientFormsIdentity.cs
- EntitySetDataBindingList.cs
- Triangle.cs
- RecordBuilder.cs
- AutoSizeComboBox.cs
- MissingSatelliteAssemblyException.cs
- Button.cs
- HttpProxyCredentialType.cs
- WorkflowOwnershipException.cs
- DataGridViewHeaderCell.cs
- QilFactory.cs
- CompositionAdorner.cs
- TextServicesCompartmentContext.cs
- ButtonPopupAdapter.cs
- AspCompat.cs
- OLEDB_Enum.cs
- DiagnosticsConfigurationHandler.cs
- HttpListenerRequestTraceRecord.cs
- ClientTarget.cs
- Menu.cs
- IdentityHolder.cs
- PolyLineSegment.cs
- EventToken.cs
- EntityDataSourceState.cs
- UriTemplateVariablePathSegment.cs
- JoinGraph.cs
- StreamReader.cs
- QuarticEase.cs
- SqlDependencyListener.cs
- CodeMethodReturnStatement.cs
- RowVisual.cs
- EnumConverter.cs
- UInt16Converter.cs
- HierarchicalDataSourceControl.cs
- ClientSettingsProvider.cs
- XmlEventCache.cs
- StylusPointCollection.cs
- TextSpanModifier.cs
- Label.cs
- Translator.cs
- OperationParameterInfoCollection.cs
- MessageBuilder.cs
- ConditionalWeakTable.cs
- DelimitedListTraceListener.cs
- DataGridViewColumnStateChangedEventArgs.cs
- ContentControl.cs
- TreeNodeCollection.cs
- MultipartContentParser.cs
- InputScope.cs