Dare I ... another volatile discussion ?
Kagamin via Digitalmars-d
digitalmars-d at puremagic.com
Sat May 9 05:16:57 PDT 2015
On Thursday, 7 May 2015 at 16:04:56 UTC, Jens Bauer wrote:
> Regarding (1), because marking a variable 'shared' is not
> enough (it allows instructions to be moved around), Johannes
> already made a volatileLoad and volatileStore, which will be
> usable for microcontrollers, though for convenience, it
> requires writing additional code.
> -But this solution ... I do not know if it would work, when
> writing a driver for Debian running on a i586 platform or
> PowerMac G3 for instance.
System calls on sufficiently smart processors like x86 use C-like
ABI good practices: registers and buffers to pass data instead of
global variables, because multithreaded programs will have race
condition on accessing the global variables. See read(2) syscall
as an example of such API
http://man7.org/linux/man-pages/man2/read.2.html
On Thursday, 7 May 2015 at 18:18:02 UTC, Johannes Pfau wrote:
> Not sure about shared (I don't think anybody knows what exactly
> shared is supposed to do)
Shared is supposed to prevent the programmer from accidentally
putting unshared data in a shared context. Expectedly people
wanted it to be a silver bullet for concurrency, instead
std.concurrency provides high-level concurrency safety.
More information about the Digitalmars-d
mailing list