forked from Rust-related/RustPython
User arr_macro to create triggers array
This commit is contained in:
22
Cargo.lock
generated
22
Cargo.lock
generated
@@ -33,6 +33,25 @@ dependencies = [
|
||||
"scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arr_macro"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"arr_macro_impl 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro-hack 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arr_macro_impl"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro-hack 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.4.11"
|
||||
@@ -1011,6 +1030,7 @@ dependencies = [
|
||||
name = "rustpython-vm"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"arr_macro 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"blake2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1855,6 +1875,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "36b7aa1ccb7d7ea3f437cf025a2ab1c47cc6c1bc9fc84918ff449def12f5e282"
|
||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392"
|
||||
"checksum arr_macro 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d262b83f2f573121554ad6e764cd444303df85d86e5fcebc81903ddcf8dd3a97"
|
||||
"checksum arr_macro_impl 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8decbe97ffec939e44228d91e5d0829ceb1616c6ed0984c09df164b1e7ebaafc"
|
||||
"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba"
|
||||
"checksum ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b385d69402821a1c254533a011a312531cbcc0e3e24f19bbb4747a5a2daf37e2"
|
||||
"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90"
|
||||
|
||||
@@ -63,6 +63,7 @@ bitflags = "1.1"
|
||||
libc = "0.2"
|
||||
nix = "0.14.1"
|
||||
wtf8 = "0.0.3"
|
||||
arr_macro = "0.1.2"
|
||||
|
||||
flame = { version = "0.2", optional = true }
|
||||
flamer = { version = "0.3", optional = true }
|
||||
|
||||
@@ -6,30 +6,14 @@ use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use num_traits::cast::ToPrimitive;
|
||||
|
||||
use arr_macro::arr;
|
||||
use nix::sys::signal;
|
||||
use nix::unistd::alarm as sig_alarm;
|
||||
|
||||
// Signal triggers
|
||||
// TODO: 64
|
||||
const NSIG: usize = 15;
|
||||
const NSIG: usize = 64;
|
||||
|
||||
static mut TRIGGERS: [AtomicBool; NSIG] = [
|
||||
AtomicBool::new(false),
|
||||
AtomicBool::new(false),
|
||||
AtomicBool::new(false),
|
||||
AtomicBool::new(false),
|
||||
AtomicBool::new(false),
|
||||
AtomicBool::new(false),
|
||||
AtomicBool::new(false),
|
||||
AtomicBool::new(false),
|
||||
AtomicBool::new(false),
|
||||
AtomicBool::new(false),
|
||||
AtomicBool::new(false),
|
||||
AtomicBool::new(false),
|
||||
AtomicBool::new(false),
|
||||
AtomicBool::new(false),
|
||||
AtomicBool::new(false),
|
||||
];
|
||||
// We cannot use the NSIG const in the arr macro. This will fail compilation if NSIG is different.
|
||||
static mut TRIGGERS: [AtomicBool; NSIG] = arr![AtomicBool::new(false); 64];
|
||||
|
||||
extern "C" fn run_signal(signum: i32) {
|
||||
unsafe {
|
||||
|
||||
Reference in New Issue
Block a user