mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-18 03:56:42 +00:00
Correct lock usages in UNIX sockets
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
14531cd99f
commit
1aa8b0abc6
@ -160,7 +160,7 @@ pub(super) struct Backlog {
|
||||
addr: UnixSocketAddrBound,
|
||||
pollee: Pollee,
|
||||
backlog: AtomicUsize,
|
||||
incoming_conns: Mutex<Option<VecDeque<Connected>>>,
|
||||
incoming_conns: SpinLock<Option<VecDeque<Connected>>>,
|
||||
wait_queue: WaitQueue,
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ impl Backlog {
|
||||
addr,
|
||||
pollee,
|
||||
backlog: AtomicUsize::new(backlog),
|
||||
incoming_conns: Mutex::new(incoming_sockets),
|
||||
incoming_conns: SpinLock::new(incoming_sockets),
|
||||
wait_queue: WaitQueue::new(),
|
||||
}
|
||||
}
|
||||
|
@ -24,21 +24,21 @@ use crate::{
|
||||
};
|
||||
|
||||
pub struct UnixStreamSocket {
|
||||
state: RwLock<Takeable<State>>,
|
||||
state: RwMutex<Takeable<State>>,
|
||||
is_nonblocking: AtomicBool,
|
||||
}
|
||||
|
||||
impl UnixStreamSocket {
|
||||
pub(super) fn new_init(init: Init, is_nonblocking: bool) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
state: RwLock::new(Takeable::new(State::Init(init))),
|
||||
state: RwMutex::new(Takeable::new(State::Init(init))),
|
||||
is_nonblocking: AtomicBool::new(is_nonblocking),
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn new_connected(connected: Connected, is_nonblocking: bool) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
state: RwLock::new(Takeable::new(State::Connected(connected))),
|
||||
state: RwMutex::new(Takeable::new(State::Connected(connected))),
|
||||
is_nonblocking: AtomicBool::new(is_nonblocking),
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user