Add some source

This commit is contained in:
Jeremy Soller
2016-08-13 15:18:41 -06:00
parent a5fd02e8c1
commit e2dedd1e38
4 changed files with 66 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
Cargo.lock
target

4
Cargo.toml Normal file
View File

@@ -0,0 +1,4 @@
[package]
name = "acid"
version = "0.1.0"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Jeremy Soller
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

39
src/main.rs Normal file
View File

@@ -0,0 +1,39 @@
///Acid testing program
use std::process::Command;
use std::thread;
fn main() {
println!("Trying to kill kernel...");
let mut threads = Vec::new();
for i in 0..10 {
threads.push(thread::spawn(move || {
let mut sub_threads = Vec::new();
for j in 0..10 {
sub_threads.push(thread::spawn(move || {
Command::new("sh")
.arg("-c")
.arg(&format!("echo {}:{}", i, j))
.spawn().unwrap()
.wait().unwrap();
}));
}
Command::new("sh")
.arg("-c")
.arg(&format!("echo {}", i))
.spawn().unwrap()
.wait().unwrap();
for sub_thread in sub_threads {
sub_thread.join().unwrap();
}
}));
}
for thread in threads {
thread.join().unwrap();
}
println!("Kernel survived!");
}