You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A simple example compiles on Linux but fails on Windows:
use tokio;
use tokio_serial as serial;
#[tokio::main]
async fn main() {
let builder = serial::new("example/port", 9600);
if let Ok(stream) = serial::SerialStream::open(&builder) {
tokio::spawn(async move {
let _ = stream.writable().await;
});
}
}
This fails to compile on Windows with "*mut c_void cannot be shared between threads safely".
Perhaps this is a known limitation? I believe the cause is the difference in internal representation, and the additional "com" struct required for Windows systems. Is there a recommended workaround?
Thanks for your help! And apologies if this was already known.
The text was updated successfully, but these errors were encountered:
Looks like the line in question (line 67 in lib.rs) is 3 years old (commit a0c1cdd), so I imagine it's not a new issue. I only encountered the issue because I'm in the process of porting Linux code to Windows.
Was it working for you recently? Could be an issue caused upstream.
The issue stems for the usage of raw HANDLE type in serialport::COMPort which is a *mut c_void.
The Send constraint become a Sync constraint on the HANDLE. The issue is on the upstream and they should wrap the HANDLE in a wrapper that is Sync because windows HANDLE are safe to share.
A simple example compiles on Linux but fails on Windows:
This fails to compile on Windows with "*mut c_void cannot be shared between threads safely".
Perhaps this is a known limitation? I believe the cause is the difference in internal representation, and the additional "com" struct required for Windows systems. Is there a recommended workaround?
Thanks for your help! And apologies if this was already known.
The text was updated successfully, but these errors were encountered: