diff --git a/crates/lanparty-client-tap/src/windows.rs b/crates/lanparty-client-tap/src/windows.rs index cf1952c..8569cf7 100644 --- a/crates/lanparty-client-tap/src/windows.rs +++ b/crates/lanparty-client-tap/src/windows.rs @@ -234,6 +234,16 @@ pub fn available_adapters() -> Result> { #[derive(Debug)] struct OwnedHandle(HANDLE); +// SAFETY: Windows file handles are process-wide kernel object references that may be used from +// multiple threads. `OwnedHandle` only closes the handle in `Drop`; callers must still uphold any +// higher-level synchronization required by the device protocol. +unsafe impl Send for OwnedHandle {} + +// SAFETY: Sharing references to `OwnedHandle` only exposes the raw handle to synchronous Windows +// APIs. The handle value itself is immutable, and Windows permits issuing I/O on a file handle from +// more than one thread. +unsafe impl Sync for OwnedHandle {} + impl OwnedHandle { fn new(handle: HANDLE) -> io::Result { if handle == INVALID_HANDLE_VALUE {