kernel: Only sanity-check interrupts in switch_sem_etc under KDEBUG.

"are_interrupts_enabled()" is a "relatively" expensive function, so avoiding
it makes sense. This is the same way it's done elsewhere in sem.cpp, as well
as for mutexes and condition variables also.
This commit is contained in:
Augustin Cavalier 2019-02-17 14:34:36 -05:00
parent c61fa718f2
commit 1eededf17f
1 changed files with 2 additions and 1 deletions

View File

@ -763,11 +763,12 @@ switch_sem_etc(sem_id semToBeReleased, sem_id id, int32 count,
return B_OK;
if (sSemsActive == false)
return B_NO_MORE_SEMS;
#if KDEBUG
if (!are_interrupts_enabled()) {
panic("switch_sem_etc: called with interrupts disabled for sem "
"%" B_PRId32 "\n", id);
}
#endif
if (id < 0)
return B_BAD_SEM_ID;