|
|
Log in / Subscribe / Register

overly strict semantics

overly strict semantics

Posted Jan 10, 2026 15:42 UTC (Sat) by bjackman (subscriber, #109548)
In reply to: overly strict semantics by bertschingert
Parent article: READ_ONCE(), WRITE_ONCE(), but not for Rust

I think one of the most common usecases for {READ,WRITE}_ONCE is where you have concurrency without parallelism. E.g. when sharing CPU-local data between a task and an IRQ.

IIUC C11's relaxed ordering is too weak for that, but any of the other C11 orderings are likely to be unnecessarily strict, i.e. they might force the use of special (costly) CPU instructions where normal reads and writes are already safe enough.


to post comments

overly strict semantics

Posted Jan 11, 2026 17:57 UTC (Sun) by garyguo (subscriber, #173367) [Link]

I think in C11 ordering, a relaxed op is too weak, but a relaxed op + an atomic signal fence (which is usually just a compiler barrier) is sufficient. Alternatively, a volatile relaxed op should also be sufficient.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds