summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2020-07-10 14:42:21 -0500
committerJeff Epler <jepler@gmail.com>2020-07-15 09:26:47 -0500
commit36b46465167f15eaf8535608b16859e6de10fac8 (patch)
tree55d5de3eeb516c1853337416c0da754eb333d1c0
parentaf520729fe9d941c293942730f520b50ec1daf52 (diff)
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.
-rw-r--r--supervisor/shared/background_callback.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c
index 99607b7a8..e45c9b5c3 100644
--- a/supervisor/shared/background_callback.c
+++ b/supervisor/shared/background_callback.c
@@ -61,8 +61,11 @@ void background_callback_add(background_callback_t *cb, background_callback_fun
static bool in_background_callback;
void background_callback_run_all() {
+ if (!callback_head) {
+ return;
+ }
CALLBACK_CRITICAL_BEGIN;
- if(in_background_callback) {
+ if (in_background_callback) {
CALLBACK_CRITICAL_END;
return;
}