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
- DispatcherObject.cs
- DefaultEventAttribute.cs
- COMException.cs
- TimeSpanOrInfiniteConverter.cs
- WebPartUtil.cs
- InheritanceAttribute.cs
- DynamicEntity.cs
- SqlTriggerContext.cs
- DataGridViewElement.cs
- DragStartedEventArgs.cs
- TrackingStringDictionary.cs
- DBConnectionString.cs
- smtppermission.cs
- ProfileManager.cs
- SqlWriter.cs
- PartialCachingAttribute.cs
- ContextMenuStripGroupCollection.cs
- XmlElement.cs
- Base64WriteStateInfo.cs
- FontDialog.cs
- GACIdentityPermission.cs
- ConstraintStruct.cs
- HtmlTitle.cs
- UTF32Encoding.cs
- Random.cs
- Internal.cs
- PreviewPageInfo.cs
- CompressStream.cs
- StylusLogic.cs
- CheckBoxBaseAdapter.cs
- BitmapCache.cs
- ProtocolImporter.cs
- X509CertificateStore.cs
- LocalFileSettingsProvider.cs
- QilSortKey.cs
- TextContainerHelper.cs
- XPathChildIterator.cs
- StreamGeometry.cs
- RTLAwareMessageBox.cs
- CatalogZoneBase.cs
- DataGridViewHitTestInfo.cs
- SynchronizationLockException.cs
- SqlCacheDependency.cs
- FileVersion.cs
- SmiContextFactory.cs
- ApplicationFileParser.cs
- MembershipSection.cs
- SequenceFullException.cs
- InputGestureCollection.cs
- LockedHandleGlyph.cs
- ResourceDictionary.cs
- XmlNamespaceManager.cs
- TypeUsageBuilder.cs
- BrushValueSerializer.cs
- SqlFlattener.cs
- ToolbarAUtomationPeer.cs
- DoubleCollectionValueSerializer.cs
- LoginCancelEventArgs.cs
- QilDataSource.cs
- OracleBoolean.cs
- HtmlTableCellCollection.cs
- SemaphoreSlim.cs
- TextInfo.cs
- BezierSegment.cs
- XmlSerializerSection.cs
- Vector3DAnimation.cs
- DynamicValueConverter.cs
- TCEAdapterGenerator.cs
- UiaCoreApi.cs
- DataGridTable.cs
- CompressStream.cs
- BufferedGraphicsContext.cs
- ProbeDuplex11AsyncResult.cs
- MatrixTransform3D.cs
- PrintControllerWithStatusDialog.cs
- PersonalizationState.cs
- HtmlTextArea.cs
- IPHostEntry.cs
- IisTraceWebEventProvider.cs
- Authorization.cs
- DockPattern.cs
- DurableTimerExtension.cs
- PackageFilter.cs
- WorkflowDebuggerSteppingAttribute.cs
- UnionExpr.cs
- ModelTreeEnumerator.cs
- ListBoxItemWrapperAutomationPeer.cs
- SurrogateSelector.cs
- IisTraceListener.cs
- Label.cs
- ConfigDefinitionUpdates.cs
- Utils.cs
- EdgeProfileValidation.cs
- StyleHelper.cs
- ImageList.cs
- NativeCppClassAttribute.cs
- NotifyCollectionChangedEventArgs.cs
- OptimalTextSource.cs
- AutoGeneratedFieldProperties.cs
- StoreAnnotationsMap.cs