Switch Context::actions to RwLock
This commit is contained in:
@@ -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],
|
||||
|
||||
@@ -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]
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user