summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--talpid-windows/src/io.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/talpid-windows/src/io.rs b/talpid-windows/src/io.rs
index 1bcffb30d3..cd7b0ae98a 100644
--- a/talpid-windows/src/io.rs
+++ b/talpid-windows/src/io.rs
@@ -4,18 +4,24 @@ use windows_sys::Win32::System::IO::OVERLAPPED;
use crate::sync::Event;
/// Abstraction over `OVERLAPPED`.
+///
+/// - https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-overlapped
+/// - https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createeventw
pub struct Overlapped {
overlapped: OVERLAPPED,
event: Option<Event>,
}
+// SAFETY: Both OVERLAPPED and Event is used for async I/O, so this *should* be safe.
unsafe impl Send for Overlapped {}
+// SAFETY: See above.
unsafe impl Sync for Overlapped {}
impl Overlapped {
/// Creates an `OVERLAPPED` object with `hEvent` set.
pub fn new(event: Option<Event>) -> io::Result<Self> {
let mut overlapped = Overlapped {
+ // SAFETY: OVERLAPPED is a C struct and can safely be zeroed.
overlapped: unsafe { mem::zeroed() },
event: None,
};