Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build on windows #21

Merged
merged 3 commits into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .appveyor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
environment:
matrix:
- TARGET: i686-pc-windows-msvc
CHANNEL: stable
- TARGET: x86_64-pc-windows-gnu
CHANNEL: stable
- TARGET: x86_64-pc-windows-msvc
CHANNEL: stable
- TARGET: i686-pc-windows-msvc
CHANNEL: nightly
- TARGET: x86_64-pc-windows-gnu
CHANNEL: nightly
- TARGET: x86_64-pc-windows-msvc
CHANNEL: nightly

install:
- curl -sSf -o rustup-init.exe https://win.rustup.rs
- rustup-init.exe --default-host %TARGET% --default-toolchain %CHANNEL% -y
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin;C:\msys64\mingw64\bin;C:\msys64\usr\bin;
- rustc -Vv
- cargo -V

build: false

test_script:
- cargo test --release
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ maintenance = { status = "actively-developed" }
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
ctrlc = "3.1.3"
tokio = "^0.1"
tokio-executor = "0.1.8"
tokio-threadpool = "0.1.15"
Expand All @@ -46,7 +47,6 @@ backtrace = "0.3.32"
ego-tree = "0.6.0"
lazy_static = "1.3.0"
objekt = "0.1.2"
signal-hook = "0.1.10"
parking_lot = "0.9"


Expand Down
16 changes: 7 additions & 9 deletions src/bastion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use env_logger::Builder;
use futures::future::poll_fn;
use lazy_static::lazy_static;
use log::LevelFilter;
use signal_hook::{iterator::Signals, SIGINT};
use std::panic::AssertUnwindSafe;
use std::sync::Arc;
use parking_lot::Mutex;
Expand All @@ -21,6 +20,7 @@ use tokio::prelude::*;
use tokio::runtime::Runtime;
use uuid::Uuid;
use std::mem;
use std::sync::atomic::{AtomicBool, Ordering};

lazy_static! {
// Platform which contains runtime system.
Expand Down Expand Up @@ -329,16 +329,14 @@ impl RuntimeManager for Bastion {

fn runtime_shutdown_callback() {
let mut entered = tokio_executor::enter().expect("main thread_local runtime lock");
let signals = Signals::new(&[SIGINT]).unwrap();

let running = Arc::new(AtomicBool::new(true));
let r = running.clone();
let _ = ctrlc::set_handler(move || {
r.store(false, Ordering::SeqCst);
}).unwrap();
entered
.block_on(poll_fn(|| {
for sig in signals.forever() {
match sig {
signal_hook::SIGINT => break,
_ => unreachable!(),
}
}
while running.load(Ordering::SeqCst) {}
CLOSE_OVER
}))
.expect("cannot shutdown");
Expand Down