Tactility/Platforms/platform-posix/freertos/freertos_task_hooks.c
Ken Van Hoeylandt 6e437d3288
Location services, kernel Device improvements, de-incubate devices, and more (#691)
**New Features**
  * Added location services with GPS and network-based positioning, approximate or precise accuracy, and live status updates.
  * Added a Location Settings app to view status, control location access and accuracy, and manage GPS devices.
  * Added location choices during device setup and a location toggle in the system menu.
  * Added support for thread stacks in external memory when available, with fallback to existing memory options.

**Improvements**
  * Wi-Fi and Bluetooth enabled states are saved when changed and applied at startup; separate “Enable on boot” switches are no longer shown in their management screens.
  * GPS setup can stop promptly when interrupted.
  * Improved device removal handling during startup and while references are outstanding.
  * Updated several device listings to no longer be marked as incubating.
2026-10-13 23:13:30 +02:00

38 lines
1.3 KiB
C

// SPDX-License-Identifier: Apache-2.0
#include "freertos_task_hooks.h"
#include <pthread.h>
#include <signal.h>
static FreeRtosTaskCreateHook create_hook = NULL;
static FreeRtosTaskDeleteHook delete_hook = NULL;
void freertos_set_task_hooks(FreeRtosTaskCreateHook create, FreeRtosTaskDeleteHook delete_task) {
create_hook = create;
delete_hook = delete_task;
}
BaseType_t xTaskCreate(TaskFunction_t function, const char* const name, const configSTACK_DEPTH_TYPE stack_depth, void* const parameter, UBaseType_t priority, TaskHandle_t* const out_handle) {
if (create_hook != NULL) {
return create_hook(__builtin_return_address(0), function, name, stack_depth, parameter, priority, out_handle);
}
return freertos_real_xTaskCreate(function, name, stack_depth, parameter, priority, out_handle);
}
void vTaskDelete(TaskHandle_t handle) {
if (delete_hook != NULL) {
delete_hook(__builtin_return_address(0), handle);
return;
}
freertos_real_vTaskDelete(handle);
}
void vPortCancelThread(void* task) {
sigset_t all_signals;
sigset_t previous_signals;
sigfillset(&all_signals);
pthread_sigmask(SIG_BLOCK, &all_signals, &previous_signals);
freertos_real_vPortCancelThread(task);
pthread_sigmask(SIG_SETMASK, &previous_signals, NULL);
}