sem_acquire has no reason to do a notify! (#857)

This commit is contained in:
Graham Sanderson 2022-06-20 09:52:43 -05:00 committed by GitHub
parent 9644399993
commit 8f09099757
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,7 +23,7 @@ void __time_critical_func(sem_acquire_blocking)(semaphore_t *sem) {
uint32_t save = spin_lock_blocking(sem->core.spin_lock); uint32_t save = spin_lock_blocking(sem->core.spin_lock);
if (sem->permits > 0) { if (sem->permits > 0) {
sem->permits--; sem->permits--;
lock_internal_spin_unlock_with_notify(&sem->core, save); spin_unlock(sem->core.spin_lock, save);
break; break;
} }
lock_internal_spin_unlock_with_wait(&sem->core, save); lock_internal_spin_unlock_with_wait(&sem->core, save);
@ -43,7 +43,7 @@ bool __time_critical_func(sem_acquire_block_until)(semaphore_t *sem, absolute_ti
uint32_t save = spin_lock_blocking(sem->core.spin_lock); uint32_t save = spin_lock_blocking(sem->core.spin_lock);
if (sem->permits > 0) { if (sem->permits > 0) {
sem->permits--; sem->permits--;
lock_internal_spin_unlock_with_notify(&sem->core, save); spin_unlock(sem->core.spin_lock, save);
return true; return true;
} }
if (lock_internal_spin_unlock_with_best_effort_wait_or_timeout(&sem->core, save, until)) { if (lock_internal_spin_unlock_with_best_effort_wait_or_timeout(&sem->core, save, until)) {
@ -56,7 +56,7 @@ bool __time_critical_func(sem_try_acquire)(semaphore_t *sem) {
uint32_t save = spin_lock_blocking(sem->core.spin_lock); uint32_t save = spin_lock_blocking(sem->core.spin_lock);
if (sem->permits > 0) { if (sem->permits > 0) {
sem->permits--; sem->permits--;
lock_internal_spin_unlock_with_notify(&sem->core, save); spin_unlock(sem->core.spin_lock, save);
return true; return true;
} }
spin_unlock(sem->core.spin_lock, save); spin_unlock(sem->core.spin_lock, save);