浏览代码

Enhance app manager (#1011)

Add app_manager_is_started API per requested by #1004 to support
checking the status of app manager in another thread.
Wenyong Huang 4 年之前
父节点
当前提交
9fc124b06f
共有 2 个文件被更改,包括 15 次插入0 次删除
  1. 11 0
      core/app-mgr/app-manager/app_manager.c
  2. 4 0
      core/app-mgr/app-mgr-shared/app_manager_export.h

+ 11 - 0
core/app-mgr/app-manager/app_manager.c

@@ -13,6 +13,7 @@
 
 /* Queue of app manager */
 static bh_queue *g_app_mgr_queue;
+static bool g_app_mgr_started;
 
 void *
 get_app_manager_queue()
@@ -381,9 +382,13 @@ app_manager_startup(host_interface *interface)
 
     app_manager_printf("App Manager started.\n");
 
+    g_app_mgr_started = true;
+
     /* Enter loop run */
     bh_queue_enter_loop_run(g_app_mgr_queue, app_manager_queue_callback, NULL);
 
+    g_app_mgr_started = false;
+
     /* Destroy registered resources */
     am_cleanup_registeration(ID_APP_MGR);
 
@@ -397,6 +402,12 @@ fail1:
     bh_queue_destroy(g_app_mgr_queue);
 }
 
+bool
+app_manager_is_started(void)
+{
+    return g_app_mgr_started;
+}
+
 #include "module_config.h"
 
 module_interface *g_module_interfaces[Module_Max] = {

+ 4 - 0
core/app-mgr/app-mgr-shared/app_manager_export.h

@@ -183,6 +183,10 @@ app_manager_host_init(host_interface *intf);
 void
 app_manager_startup(host_interface *intf);
 
+/* Return whether app manager is started */
+bool
+app_manager_is_started(void);
+
 /* Get queue of current applet */
 void *
 app_manager_get_module_queue(uint32 module_type, void *module_inst);