diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs index 9539b7182eba9b..36937252a18314 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs @@ -586,7 +586,7 @@ public void SetCompressedStack(CompressedStack stack) public static long VolatileRead(ref long address) => Volatile.Read(ref address); [Obsolete(Obsoletions.ThreadVolatileReadWriteMessage, DiagnosticId = Obsoletions.ThreadVolatileReadWriteDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] - public static IntPtr VolatileRead(ref IntPtr address) => Volatile.Read(ref address); + public static nint VolatileRead(ref nint address) => Volatile.Read(ref address); [Obsolete(Obsoletions.ThreadVolatileReadWriteMessage, DiagnosticId = Obsoletions.ThreadVolatileReadWriteDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] [return: NotNullIfNotNull(nameof(address))] @@ -613,7 +613,7 @@ public void SetCompressedStack(CompressedStack stack) [Obsolete(Obsoletions.ThreadVolatileReadWriteMessage, DiagnosticId = Obsoletions.ThreadVolatileReadWriteDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] [CLSCompliant(false)] - public static UIntPtr VolatileRead(ref UIntPtr address) => Volatile.Read(ref address); + public static nuint VolatileRead(ref nuint address) => Volatile.Read(ref address); [Obsolete(Obsoletions.ThreadVolatileReadWriteMessage, DiagnosticId = Obsoletions.ThreadVolatileReadWriteDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] public static void VolatileWrite(ref byte address, byte value) => Volatile.Write(ref address, value); @@ -631,7 +631,7 @@ public void SetCompressedStack(CompressedStack stack) public static void VolatileWrite(ref long address, long value) => Volatile.Write(ref address, value); [Obsolete(Obsoletions.ThreadVolatileReadWriteMessage, DiagnosticId = Obsoletions.ThreadVolatileReadWriteDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] - public static void VolatileWrite(ref IntPtr address, IntPtr value) => Volatile.Write(ref address, value); + public static void VolatileWrite(ref nint address, nint value) => Volatile.Write(ref address, value); [Obsolete(Obsoletions.ThreadVolatileReadWriteMessage, DiagnosticId = Obsoletions.ThreadVolatileReadWriteDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] public static void VolatileWrite([NotNullIfNotNull(nameof(value))] ref object? address, object? value) => Volatile.Write(ref address, value); @@ -657,7 +657,7 @@ public void SetCompressedStack(CompressedStack stack) [Obsolete(Obsoletions.ThreadVolatileReadWriteMessage, DiagnosticId = Obsoletions.ThreadVolatileReadWriteDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] [CLSCompliant(false)] - public static void VolatileWrite(ref UIntPtr address, UIntPtr value) => Volatile.Write(ref address, value); + public static void VolatileWrite(ref nuint address, nuint value) => Volatile.Write(ref address, value); /// /// Manages functionality required to support members of dealing with thread-local data diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Volatile.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Volatile.cs index e7d2cb04096376..f8a9a562b24d63 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Volatile.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Volatile.cs @@ -107,17 +107,17 @@ public static void Write(ref long location, long value) => #endregion #region IntPtr - private struct VolatileIntPtr { public volatile IntPtr Value; } + private struct VolatileIntPtr { public volatile nint Value; } [Intrinsic] [NonVersionable] - public static IntPtr Read(ref readonly IntPtr location) => - Unsafe.As(ref Unsafe.AsRef(in location)).Value; + public static nint Read(ref readonly nint location) => + Unsafe.As(ref Unsafe.AsRef(in location)).Value; [Intrinsic] [NonVersionable] - public static void Write(ref IntPtr location, IntPtr value) => - Unsafe.As(ref location).Value = value; + public static void Write(ref nint location, nint value) => + Unsafe.As(ref location).Value = value; #endregion #region SByte @@ -197,19 +197,19 @@ public static void Write(ref ulong location, ulong value) => #endregion #region UIntPtr - private struct VolatileUIntPtr { public volatile UIntPtr Value; } + private struct VolatileUIntPtr { public volatile nuint Value; } [CLSCompliant(false)] [Intrinsic] [NonVersionable] - public static UIntPtr Read(ref readonly UIntPtr location) => - Unsafe.As(ref Unsafe.AsRef(in location)).Value; + public static nuint Read(ref readonly nuint location) => + Unsafe.As(ref Unsafe.AsRef(in location)).Value; [CLSCompliant(false)] [Intrinsic] [NonVersionable] - public static void Write(ref UIntPtr location, UIntPtr value) => - Unsafe.As(ref location).Value = value; + public static void Write(ref nuint location, nuint value) => + Unsafe.As(ref location).Value = value; #endregion #region T