mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-21 16:33:24 +00:00
Refactor semaphore to support atomic semop
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
9a2faff07b
commit
6ce50fab1c
@ -58,10 +58,12 @@ fn do_sys_semtimedop(
|
||||
}
|
||||
|
||||
let user_space = ctx.get_user_space();
|
||||
let mut semops = Vec::with_capacity(nsops);
|
||||
for i in 0..nsops {
|
||||
let sem_buf = user_space.read_val::<SemBuf>(tsops + size_of::<SemBuf>() * i)?;
|
||||
sem_op(sem_id, &sem_buf, timeout, ctx)?;
|
||||
semops.push(user_space.read_val::<SemBuf>(tsops + size_of::<SemBuf>() * i)?);
|
||||
}
|
||||
|
||||
sem_op(sem_id, semops, timeout, ctx)?;
|
||||
|
||||
Ok(SyscallReturn::Return(0))
|
||||
}
|
||||
|
Reference in New Issue
Block a user