Skip to content

Commit

Permalink
Require PTYImpl trait to implement Send and Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
andfoy committed Jan 11, 2022
1 parent 48efc81 commit fd6be6c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/pty/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::os::windows::ffi::OsStrExt;
use super::PTYArgs;

/// This trait should be implemented by any backend that wants to provide a PTY implementation.
pub trait PTYImpl {
pub trait PTYImpl: Sync + Send {
/// Create a new instance of the PTY backend.
///
/// # Arguments
Expand Down
3 changes: 3 additions & 0 deletions src/pty/conpty/pty_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ pub struct ConPTY {
process: PTYProcess
}

unsafe impl Send for ConPTY {}
unsafe impl Sync for ConPTY {}

impl PTYImpl for ConPTY {
fn new(args: &PTYArgs) -> Result<Box<dyn PTYImpl>, OsString> {
let mut result: HRESULT = S_OK;
Expand Down

0 comments on commit fd6be6c

Please sign in to comment.