Skip to content

Commit b314392

Browse files
Copilotjkotas
andauthored
Add documentation warning for Interlocked.Read write access requirement on 32-bit platforms (#11659)
Fixes #11658 Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: jkotas <[email protected]>
1 parent 27aa219 commit b314392

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

xml/System.Threading/Interlocked.xml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2950,6 +2950,9 @@ This method wraps a call to [FlushProcessWriteBuffers](/windows/win32/api/proces
29502950
## Remarks
29512951
The <xref:System.Threading.Interlocked.Read%2A> method is unnecessary on 64-bit systems, because 64-bit read operations are already atomic. On 32-bit systems, 64-bit read operations are not atomic unless performed using <xref:System.Threading.Interlocked.Read%2A>.
29522952
2953+
> [!IMPORTANT]
2954+
> On 32-bit platforms, despite taking a readonly reference parameter, this method requires write access to the memory location because it uses <xref:System.Threading.Interlocked.CompareExchange%2A> internally to ensure atomicity. Attempting to read from read-only memory (such as memory-mapped files opened with read-only access) can result in an <xref:System.AccessViolationException>.
2955+
29532956
]]></format>
29542957
</remarks>
29552958
<altmember cref="Overload:System.Threading.Interlocked.Increment" />
@@ -3006,7 +3009,17 @@ This method wraps a call to [FlushProcessWriteBuffers](/windows/win32/api/proces
30063009
<param name="location">The 64-bit value to be loaded.</param>
30073010
<summary>Returns a 64-bit unsigned value, loaded as an atomic operation.</summary>
30083011
<returns>The loaded value.</returns>
3009-
<remarks>To be added.</remarks>
3012+
<remarks>
3013+
<format type="text/markdown"><![CDATA[
3014+
3015+
## Remarks
3016+
The <xref:System.Threading.Interlocked.Read%2A> method is unnecessary on 64-bit systems, because 64-bit read operations are already atomic. On 32-bit systems, 64-bit read operations are not atomic unless performed using <xref:System.Threading.Interlocked.Read%2A>.
3017+
3018+
> [!IMPORTANT]
3019+
> On 32-bit platforms, despite taking a readonly reference parameter, this method requires write access to the memory location because it uses <xref:System.Threading.Interlocked.CompareExchange%2A> internally to ensure atomicity. Attempting to read from read-only memory (such as memory-mapped files opened with read-only access) can result in an <xref:System.AccessViolationException>.
3020+
3021+
]]></format>
3022+
</remarks>
30103023
</Docs>
30113024
</Member>
30123025
<Member MemberName="SpeculationBarrier">

0 commit comments

Comments
 (0)