mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-25 10:23:23 +00:00
[Semaphore] Remove Box in pending_ops
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
b3b5e136bd
commit
a8970daec2
@ -91,9 +91,9 @@ pub struct Semaphore {
|
|||||||
/// - through SEM_UNDO when task exit
|
/// - through SEM_UNDO when task exit
|
||||||
latest_modified_pid: AtomicU32,
|
latest_modified_pid: AtomicU32,
|
||||||
/// Pending alter operations. For each pending operation, it has `sem_op < 0`.
|
/// Pending alter operations. For each pending operation, it has `sem_op < 0`.
|
||||||
pending_alters: Mutex<LinkedList<Box<PendingOp>>>,
|
pending_alters: Mutex<LinkedList<PendingOp>>,
|
||||||
/// Pending zeros operations. For each pending operation, it has `sem_op = 0`.
|
/// Pending zeros operations. For each pending operation, it has `sem_op = 0`.
|
||||||
pending_const: Mutex<LinkedList<Box<PendingOp>>>,
|
pending_const: Mutex<LinkedList<PendingOp>>,
|
||||||
/// Last semop time.
|
/// Last semop time.
|
||||||
sem_otime: AtomicU64,
|
sem_otime: AtomicU64,
|
||||||
}
|
}
|
||||||
@ -210,13 +210,13 @@ impl Semaphore {
|
|||||||
// Add current to pending list
|
// Add current to pending list
|
||||||
let (waiter, waker) = Waiter::new_pair();
|
let (waiter, waker) = Waiter::new_pair();
|
||||||
let status = Arc::new(AtomicStatus::new(Status::Pending));
|
let status = Arc::new(AtomicStatus::new(Status::Pending));
|
||||||
let pending_op = Box::new(PendingOp {
|
let pending_op = PendingOp {
|
||||||
sem_buf: *sem_buf,
|
sem_buf: *sem_buf,
|
||||||
status: status.clone(),
|
status: status.clone(),
|
||||||
waker: waker.clone(),
|
waker: waker.clone(),
|
||||||
process: ctx.posix_thread.weak_process(),
|
process: ctx.posix_thread.weak_process(),
|
||||||
pid: current_pid,
|
pid: current_pid,
|
||||||
});
|
};
|
||||||
if sem_op == 0 {
|
if sem_op == 0 {
|
||||||
self.pending_const.lock().push_back(pending_op);
|
self.pending_const.lock().push_back(pending_op);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user