1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-22 08:06:17 +04:00

solve a potential unwrap error. deadlock when child lock first.

This commit is contained in:
LoremKang 2019-10-22 14:58:48 +08:00
parent a180c3b4bb
commit e6b4c77c05
2 changed files with 3 additions and 2 deletions

View File

@ -61,7 +61,8 @@ pub fn new_semary(key: usize, nsems: usize, semflg: usize) -> Arc<SemArray> {
let mut key2sem_table = KEY2SEM.write();
let mut sem_array_ref: Arc<SemArray>;
if key2sem_table.get(&key).is_none() {
let mut key_sem_array_ref = key2sem_table.get(&key);
if (key_sem_array_ref.is_none() || key_sem_array_ref.unwrap().upgrade().is_none()) {
let mut semaphores: Vec<Semaphore> = Vec::new();
for i in 0..nsems {
semaphores.push(Semaphore::new(0));

2
user

@ -1 +1 @@
Subproject commit 11baf01577e0ca87ef88e6f1f95d2192e43e5d58
Subproject commit 746114ac65b255ba7bdffba0445a162e767e0a6f