Skip to content

Commit 36b4646

Browse files
committed
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.
1 parent af52072 commit 36b4646

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

supervisor/shared/background_callback.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@ void background_callback_add(background_callback_t *cb, background_callback_fun
6161

6262
static bool in_background_callback;
6363
void background_callback_run_all() {
64+
if (!callback_head) {
65+
return;
66+
}
6467
CALLBACK_CRITICAL_BEGIN;
65-
if(in_background_callback) {
68+
if (in_background_callback) {
6669
CALLBACK_CRITICAL_END;
6770
return;
6871
}

0 commit comments

Comments
 (0)