Switch Context::actions to RwLock

This commit is contained in:
Jeremy Soller
2021-02-13 13:01:20 -07:00
parent 83dea72a50
commit 41bea0086f
4 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -241,7 +241,7 @@ pub struct Context {
/// The open files in the scheme
pub files: Arc<RwLock<Vec<Option<FileDescriptor>>>>,
/// Signal actions
pub actions: Arc<Mutex<Vec<(SigAction, usize)>>>,
pub actions: Arc<RwLock<Vec<(SigAction, usize)>>>,
/// The pointer to the user-space registers, saved after certain
/// interrupts. This pointer is somewhere inside kstack, and the
/// kstack address at the time of creation is the first element in
@@ -295,7 +295,7 @@ impl Context {
name: Arc::new(RwLock::new(String::new().into_boxed_str())),
cwd: Arc::new(RwLock::new(Vec::new())),
files: Arc::new(RwLock::new(Vec::new())),
actions: Arc::new(Mutex::new(vec![(
actions: Arc::new(RwLock::new(vec![(
SigAction {
sa_handler: unsafe { mem::transmute(SIG_DFL) },
sa_mask: [0; 2],
+1 -1
View File
@@ -17,7 +17,7 @@ pub extern "C" fn signal_handler(sig: usize) {
let contexts = contexts();
let context_lock = contexts.current().expect("context::signal_handler not inside of context");
let context = context_lock.read();
let actions = context.actions.lock();
let actions = context.actions.read();
actions[sig]
};