| Post Reply | RetroFed Forums Forum Index » Learn Programming |
| Author | Message | ||
|---|---|---|---|
Killercat103
slrpnk.net
Killercat103@slrpnk.netJoined: 2024-10-29 |
This question comes mainly from curiosity. I'm not quite sure how to phrase it best. Especially in a title. But I'm wondering if say you have one thread writing to a variable of an essentially primitive type and one thread reading them at the same time if there's any likelihood of the read happening while the variable is half written causing either weird values or undefined behavior. Take something like a value of 8 bits from I'm imagining if say 4 bits are written while we try to read it the result could be something like 11100101 To play around i made this small sample rust. It passed without making garbage. Printing at first a bunch of lines stating "String = Hello!" and second "String = Hi!" without weirdness or issues. I kind of half-expected something like "String = #æé¼¨A" or a segfault.
|
||
| 1 Original | |||
| Post Reply |
Back to top |