diff options
| author | Brooks Rady <b.j.rady@gmail.com> | 2020-12-02 14:03:46 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-02 15:03:46 +0100 |
| commit | c3fa9fb40e3cb0146169841e5a8a14f4e6ae2fea (patch) | |
| tree | 699f8bfb9f3fb3898b449b43bf6bb53278a443ea /src/main.rs | |
| parent | fic(compatibility): htop scrolling issues (#77) (diff) | |
| download | sl0ppij-c3fa9fb40e3cb0146169841e5a8a14f4e6ae2fea.tar.gz sl0ppij-c3fa9fb40e3cb0146169841e5a8a14f4e6ae2fea.tar.xz sl0ppij-c3fa9fb40e3cb0146169841e5a8a14f4e6ae2fea.zip | |
fix(threads): a race condition, build-times, and warnings (#79)
* Fix a race condition, build-times, and warnings
* Yeah, yeah... I know
* style(code): add comment to explain race condition
Co-authored-by: Aram Drevekenin <aram@poor.dev>
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs index 0f5fcf06..08bc37c3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,19 +11,15 @@ mod screen; mod terminal_pane; mod utils; -use std::io::{self, Read, Write}; +use std::io::Write; use std::os::unix::net::UnixStream; use std::path::PathBuf; use std::sync::mpsc::{channel, Receiver, Sender}; -use std::sync::{Arc, Mutex}; use std::thread; use serde::{Deserialize, Serialize}; use structopt::StructOpt; -use wasmer::{Exports, Function, Instance, Module, Store, Value}; -use wasmer_wasi::WasiState; - use crate::command_is_executing::CommandIsExecuting; use crate::input::input_loop; use crate::layout::Layout; @@ -257,13 +253,17 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: Opt) { // Here be dragons! This is very much a work in progress, and isn't quite functional // yet. It's being left out of the tests because is slows them down massively (by // recompiling a WASM module for every single test). Stay tuned for more updates! - #[cfg(not(test))] + #[cfg(feature = "wasm-wip")] active_threads.push( thread::Builder::new() .name("wasm".to_string()) .spawn(move || { // TODO: Clone shared state here move || -> Result<(), Box<dyn std::error::Error>> { + use std::io; + use std::sync::{Arc, Mutex}; + use wasmer::{Exports, Function, Instance, Module, Store, Value}; + use wasmer_wasi::WasiState; let store = Store::default(); println!("Compiling module..."); @@ -364,6 +364,7 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: Opt) { let _ipc_thread = thread::Builder::new() .name("ipc_server".to_string()) .spawn({ + use std::io::Read; let send_pty_instructions = send_pty_instructions.clone(); let send_screen_instructions = send_screen_instructions.clone(); move || { |
