Skip to content

SerialStream is Send on Linux but not WindowsΒ #69

@doylep

Description

@doylep

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions