Now with Atomicity

This commit is contained in:
2018-05-23 20:35:16 +02:00
parent 9f7f9598db
commit 1384971d4e
5 changed files with 12 additions and 17 deletions

View File

@@ -1,13 +1,12 @@
extern crate rustijvm;
use std::fs::File;
use std::rc::Rc;
use std::sync::Mutex;
use std::sync::{Arc, Mutex};
use std::io::{Cursor, Seek, SeekFrom, Read};
fn run_bfi(file: &str) -> String {
let file = File::open(file).expect("Missing bf file");
let rc = Rc::new(Mutex::new(Cursor::new(Vec::new())));
let rc = Arc::new(Mutex::new(Cursor::new(Vec::new())));
let mut machine = rustijvm::Machine::new_from_file("files/bonus/bfi.ijvm").unwrap();
machine.set_output(rc.clone());
machine.set_input(Box::new(file));