Implement a proper mutex type for future usage

This commit is contained in:
jD91mZM2
2018-10-14 15:56:34 +02:00
parent 23fe526c55
commit 75c5c04bee
12 changed files with 185 additions and 20 deletions
+2 -1
View File
@@ -5,6 +5,7 @@ use core::sync::atomic::AtomicBool;
use fs::File;
use io::LineWriter;
use mutex::Mutex;
use platform::types::*;
pub struct GlobalFile(UnsafeCell<FILE>);
@@ -13,7 +14,7 @@ impl GlobalFile {
let file = File::new(file);
let writer = LineWriter::new(unsafe { file.get_ref() });
GlobalFile(UnsafeCell::new(FILE {
lock: AtomicBool::new(false),
lock: Mutex::new(()),
file,
flags: constants::F_PERM | flags,