Just to follow up, I introduced the `Volatile` struct to my project and had to add a couple extra functions to make everything happy:

```d
module myproj.volatile;

import core.volatile;

struct Volatile(T)
{
    private T value;

    public @property T read()
    {
        return volatileLoad(&value);
    }
    alias read this;

    public void opAssign(T value)
    {
        volatileStore(&this.value, value);
    }

    public T opUnary(string s)()
    {
        T v = read();
        mixin(s ~ "v;");
        volatileStore(&this.value, v);
        return v;
    }

    public T opOpAssign(string s)(T rhs)
    {
        T v = read();
        mixin("v " ~ s ~ "= rhs;");
        volatileStore(&this.value, v);
        return v;
    }
}
```

So far it is working great!

Reply via email to