Small fix with not matching types
This commit is contained in:
parent
5b8abd2a07
commit
ba895e3587
@ -24,6 +24,11 @@ pub struct Semaphore {
|
||||
|
||||
impl Semaphore {
|
||||
|
||||
/// Initializes a semaphore, so that it can be used for synchronization.
|
||||
///
|
||||
/// ### Parameters
|
||||
/// - *counter* initial value of counter
|
||||
/// - *thread_manager* Thread manager which managing threads
|
||||
pub fn new(counter: i32, thread_manager: Rc<RefCell<ThreadManager>>) -> Semaphore{
|
||||
Semaphore { counter, waiting_queue: List::new(), thread_manager}
|
||||
}
|
||||
@ -153,7 +158,10 @@ impl Lock {
|
||||
}
|
||||
|
||||
pub fn held_by_current_thread(&mut self, current_thread: Rc<RefCell<Thread>>) -> bool {
|
||||
Rc::ptr_eq(&self.owner, ¤t_thread)
|
||||
match &self.owner {
|
||||
Some(x) => Rc::ptr_eq(&x, ¤t_thread),
|
||||
None => false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user