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:
parent
a180c3b4bb
commit
e6b4c77c05
@ -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
2
user
@ -1 +1 @@
|
||||
Subproject commit 11baf01577e0ca87ef88e6f1f95d2192e43e5d58
|
||||
Subproject commit 746114ac65b255ba7bdffba0445a162e767e0a6f
|
Loading…
Reference in New Issue
Block a user