Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upUse a real Volatile struct #288
Comments
This comment has been minimized.
This comment has been minimized.
|
I am not sure why we need a wrapper for the I believe most of the time, the user of the API will not change this value directly: it will be updated by the Moreover, it seems to be used only in the Am I missing something? |
This comment has been minimized.
This comment has been minimized.
|
Generally, it seemed a good idea to statically prevent inappropriate accesses to volatile fields at the sys crates level. The higher level crates so far haven't touched such fields because the API functions take care of that indeed. I suspect |
This comment has been minimized.
This comment has been minimized.
|
I guess changing #[repr(C)]
pub struct Volatile<T> {
pub volatile: T,
} |
This comment has been minimized.
This comment has been minimized.
|
Having a public field would help me. I have another idea, but I am not sure if it is good thought and it only works for the My issue is that I want to create a const struct with a enum RefCount {
NoRefCount,
RefCount(Volatile),
}I don't think creating a const struct with a ref count make sense, so the |
This comment has been minimized.
This comment has been minimized.
|
Eh, I don't think this kind of special treatment for some fields in the sys crates is going to work. |
This comment has been minimized.
This comment has been minimized.
|
Ok, then if we could make the field public, this code would work. |
This comment has been minimized.
This comment has been minimized.
|
|
gkoz commentedOct 25, 2016
We might want to import
Volatilefrom thevolatilecrate in the sys crates. It doesn't have a constructor though, so @antoyo you might still not be entirely happy with it.gtk-rs/sys#25 (comment)