Skip to content

Commit

Permalink
Change to mutable reference.
Browse files Browse the repository at this point in the history
  • Loading branch information
travis1829 committed Jan 21, 2021
1 parent 488155e commit dcfd735
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions kernel-rs/src/proc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,15 @@ pub trait Waitable {
/// `raw_release()` and `raw_acquire` must always be used as a pair.
/// Use these only for temporarily releasing (and then acquiring) the lock.
/// Also, do not access `self` until re-acquiring the lock with `raw_acquire()`.
unsafe fn raw_release(&self);
unsafe fn raw_release(&mut self);

/// Acquires the inner `RawSpinlock`.
///
/// # Safety
///
/// `raw_release()` and `raw_acquire` must always be used as a pair.
/// Use these only for temporarily releasing (and then acquiring) the lock.
unsafe fn raw_acquire(&self);
unsafe fn raw_acquire(&mut self);
}

pub struct WaitChannel {
Expand Down
4 changes: 2 additions & 2 deletions kernel-rs/src/sleepablelock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ impl<T> SleepablelockGuard<'_, T> {
}

impl<T> Waitable for SleepablelockGuard<'_, T> {
unsafe fn raw_release(&self) {
unsafe fn raw_release(&mut self) {
self.lock.lock.release();
}
unsafe fn raw_acquire(&self) {
unsafe fn raw_acquire(&mut self) {
self.lock.lock.acquire();
}
}
Expand Down
8 changes: 4 additions & 4 deletions kernel-rs/src/spinlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ impl<T> SpinlockGuard<'_, T> {
}

impl<T> Waitable for SpinlockGuard<'_, T> {
unsafe fn raw_release(&self) {
unsafe fn raw_release(&mut self) {
self.lock.lock.release();
}
unsafe fn raw_acquire(&self) {
unsafe fn raw_acquire(&mut self) {
self.lock.lock.acquire();
}
}
Expand Down Expand Up @@ -268,10 +268,10 @@ impl<T> SpinlockProtected<T> {
}

impl Waitable for SpinlockProtectedGuard<'_> {
unsafe fn raw_release(&self) {
unsafe fn raw_release(&mut self) {
self.lock.release();
}
unsafe fn raw_acquire(&self) {
unsafe fn raw_acquire(&mut self) {
self.lock.acquire();
}
}
Expand Down

0 comments on commit dcfd735

Please sign in to comment.