Merge pull request #587 from ourairquality/newlib-locks-nmi

newlib: skip locking when within the NMI Irq.
This commit is contained in:
Ruslan V. Uss 2018-06-17 13:08:41 +05:00 committed by GitHub
commit 07772c643d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -303,6 +303,10 @@ void _lock_acquire(_lock_t *lock) {
void _lock_acquire_recursive(_lock_t *lock) {
if (locks_initialized) {
if (sdk_NMIIrqIsOn) {
uart_putc(0, ':');
return;
}
xSemaphoreTakeRecursive((QueueHandle_t)*lock, portMAX_DELAY);
}
}
@ -321,6 +325,9 @@ void _lock_release(_lock_t *lock) {
void _lock_release_recursive(_lock_t *lock) {
if (locks_initialized) {
if (sdk_NMIIrqIsOn) {
return;
}
xSemaphoreGiveRecursive((QueueHandle_t)*lock);
}
}