// SPDX-License-Identifier: Apache-2.0 #pragma once #include #ifdef __cplusplus extern "C" { #endif /** * @return the app_instance_id of whichever app instance's task is calling this (every app * instance's task stashes it in its own thread-local storage when it starts), or 0 if called * from a task that isn't a running app instance. An app's own main() typically calls this once, * near the top, to learn its own instance id - see e.g. app_event_subscribe()/ * window_manager_create(), both of which need it. */ AppInstanceId app_scheduler_current_app_id(void); /** * Ends the calling app instance as if its main() returned @a status, by ending its task in place. * The calling frames are never resumed. Like std::exit(), automatic objects are not destroyed * (the simulator's thread exit may still destroy them). Memory the app allocated is not freed. * Returns only when not called from an app instance's own main task. */ void app_scheduler_exit_current(int32_t status); #ifdef __cplusplus } #endif