Skip to content

Commit 429977b

Browse files
committed
zephyr: Semaphore methods should not be mut
The semaphore implementation is safe to use in multiple places, so mut is not necessary and prevents their use in most cases. Signed-off-by: David Brown <[email protected]>
1 parent 85a825f commit 429977b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

zephyr/src/sys/sync.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl Semaphore {
6565
/// Take a semaphore.
6666
///
6767
/// Can be called from ISR if called with [`NoWait`].
68-
pub fn take<T>(&mut self, timeout: T) -> Result<()>
68+
pub fn take<T>(&self, timeout: T) -> Result<()>
6969
where T: Into<Timeout>,
7070
{
7171
let timeout: Timeout = timeout.into();
@@ -79,7 +79,7 @@ impl Semaphore {
7979
///
8080
/// This routine gives to the semaphore, unless the semaphore is already at its maximum
8181
/// permitted count.
82-
pub fn give(&mut self) {
82+
pub fn give(&self) {
8383
unsafe {
8484
k_sem_give(self.item)
8585
}

0 commit comments

Comments
 (0)