mio issueshttps://gitlab.redox-os.org/redox-os/mio/-/issues2023-07-02T15:01:14Zhttps://gitlab.redox-os.org/redox-os/mio/-/issues/1Possible data race using Overlapped2023-07-02T15:01:14ZBoqin QinPossible data race using Overlappedhttps://gitlab.redox-os.org/redox-os/mio/blob/master/src/sys/windows/selector.rs#L493
Struct Overlapped implements Sync trait so as to be shared across threads by reference.
It contains a UnsafeCell, and its method `as_mut_ptr` will ret...https://gitlab.redox-os.org/redox-os/mio/blob/master/src/sys/windows/selector.rs#L493
Struct Overlapped implements Sync trait so as to be shared across threads by reference.
It contains a UnsafeCell, and its method `as_mut_ptr` will return a mutable ptr to the inner data.
This may cause a crash if one thread writes the data while another is accessing it, all by immutable reference of the struct and will bypass compiler checking.
It is rather unsafe but we marked it as safe!!!
I searched for a ref-counting version of this struct, which is much safer.
https://github.com/tokio-rs/mio/blob/master/src/sys/windows/selector.rs#L81
My suggestion is to replace the current Overlapped with this version.