callback_thread_active = true;
callback_thread = thread_new("alarm_callbacks");
if (!callback_thread) {
- LOG_ERROR("%s unable to create alarm callback thread.", __func__);
- goto error;
+ LOG_ERROR(LOG_TAG, "%s unable to create alarm callback thread.", __func__);
+ return false;
}
+ thread_set_priority(callback_thread, CALLBACK_THREAD_PRIORITY_HIGH);
thread_post(callback_thread, callback_dispatch, NULL);
return true;
-
-error:
- thread_free(callback_thread);
- callback_thread = NULL;
-
- callback_thread_active = false;
-
- semaphore_free(alarm_expired);
- alarm_expired = NULL;
-
- if (wakeup_timer_initialized)
- timer_delete(wakeup_timer);
-
- if (timer_initialized)
- timer_delete(timer);
-
- list_free(alarms);
- alarms = NULL;
-
- pthread_mutex_destroy(&monitor);
-
- return false;
}
static period_ms_t now(void) {