background_callback: Avoid CALLBACK_CRITICAL_BEGIN with nothing to do
CALLBACK_CRITICAL_BEGIN is heavyweight, but we can be confident we do not have work to do as long as callback_head is NULL. This gives back performance on nRF.
This commit is contained in:
parent
af520729fe
commit
36b4646516
@ -61,8 +61,11 @@ void background_callback_add(background_callback_t *cb, background_callback_fun
|
|||||||
|
|
||||||
static bool in_background_callback;
|
static bool in_background_callback;
|
||||||
void background_callback_run_all() {
|
void background_callback_run_all() {
|
||||||
|
if (!callback_head) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
CALLBACK_CRITICAL_BEGIN;
|
CALLBACK_CRITICAL_BEGIN;
|
||||||
if(in_background_callback) {
|
if (in_background_callback) {
|
||||||
CALLBACK_CRITICAL_END;
|
CALLBACK_CRITICAL_END;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user