dotnet / dotnet/csharpstandard
Atomicity of variable references
- Dominant language
- C#
- Stars
- 815
- Forks
- 99
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 16
Description
[Enter feedback here]
> Reads and writes of the following data types are atomic: bool, char, byte, sbyte, short, ushort, uint, int, float, and reference types. In addition, reads and writes of enum types with an underlying type in the previous list are also atomic. Reads and writes of other types, including long, ulong, double, and decimal, as well as user-defined types, are not guaranteed to be atomic.
1. reference type is atomic: in read/write
2. user-defined type is not guaranteed to be atomic
but most user-defined type is reference type , so how to distinguish the r/w atomic for reference type.
best for the example.
---
#### Document Details
⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*
* ID: d6444d2e-78cc-2bdb-f950-9a3692bcabd0
* Version Independent ID: 5523f31c-db90-b73c-a5b0-ddcc9b10cab3
* Content: [Variables - C# language specification](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/variables)
* Content Source: [spec/variables.md](https://github.com/dotnet/csharplang/blob/main/spec/variables.md)
* Product: **dotnet-csharp**
* Technology: **csharp-spec**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **wiwagn**
Contributor guide
Assessment
This issue has not been assessed yet.