Preload extmainapps

This commit is contained in:
Willy-JL
2023-05-28 00:27:58 +01:00
parent d325a1a43e
commit fc56e39075
8 changed files with 121 additions and 31 deletions

View File

@@ -236,6 +236,15 @@ FuriThread* flipper_application_spawn(FlipperApplication* app, void* args) {
return app->thread;
}
void flipper_application_despawn(FlipperApplication* app) {
furi_check(app->thread != NULL);
furi_check(!flipper_application_is_plugin(app));
furi_thread_join(app->thread);
furi_thread_free(app->thread);
app->thread = NULL;
}
static const char* preload_status_strings[] = {
[FlipperApplicationPreloadStatusSuccess] = "Success",
[FlipperApplicationPreloadStatusUnspecifiedError] = "Unknown error",
@@ -289,4 +298,4 @@ const FlipperAppPluginDescriptor*
lib_descriptor->ep_api_version);
return lib_descriptor;
}
}

View File

@@ -107,14 +107,19 @@ FlipperApplicationLoadStatus flipper_application_map_to_memory(FlipperApplicatio
/**
* @brief Create application thread at entry point address, using app name and
* stack size from metadata. Returned thread isn't started yet.
* Can be only called once for application instance.
* stack size from metadata. Returned thread isn't started yet.
* @param app Applicaiton pointer
* @param args Object to pass to app's entry point
* @return Created thread
*/
FuriThread* flipper_application_spawn(FlipperApplication* app, void* args);
/**
* @brief Cleanup application in order to re-spawn later.
* @param app Applicaiton pointer
*/
void flipper_application_despawn(FlipperApplication* app);
/**
* @brief Check if application is a plugin (not a runnable standalone app)
* @param app Application pointer