Ken Van Hoeylandt f8172446fd
App loading improvements and more (#675)
- External apps can opt into automatic cleanup when they exit, including tracked tasks, threads, files, directories, and memory.
- App-relative file paths resolve against the app’s working directory, with `.` and `..` normalized.
- The shell identifies ELF binaries that cannot be executed instead of treating them as scripts.
- Shared icon fonts now offer distinct default and large sizes, with updated icons across the interface.
- ESP32 apps can load additional ELF formats when address mirroring is enabled.
- Terminal colors render clearly on monochrome displays, and toolbar buttons have cleaner styling.
- GPS settings safely refresh their device list when their window is hidden or its widgets are destroyed.
2026-10-06 07:45:58 +02:00

30 lines
1.2 KiB
C++

// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <app/instance.h>
#include <tactility/error.h>
#include <stdint.h>
/** How long an app's own tasks get to end by themselves after its main task ended, before they're deleted. */
constexpr uint32_t APP_CLEANUP_TASK_GRACE_MS = 1000;
/** Starts tracking the resources of @a app_instance_id (see app/resources.h). */
error_t app_resources_register(AppInstanceId app_instance_id);
/**
* First phase of releasing what @a app_instance_id left behind: its tasks are deleted after APP_CLEANUP_TASK_GRACE_MS,
* and no new ones can start. Must run before the app's binary is unloaded, as they run its code.
* Until app_resources_release(), the calling task's own calls are tracked for the instance,
* so what the binary's static destructors free or close while it's unloaded is no longer tracked.
* Called by the instance's own task, after it left the instance.
*/
void app_resources_release_tasks(AppInstanceId app_instance_id);
/**
* Second phase: stops tracking @a app_instance_id, closes its files, directories and fds and frees its memory.
* Must run after the app's binary is unloaded, on the task that called app_resources_release_tasks().
*/
void app_resources_release(AppInstanceId app_instance_id);