Add new internal functions for candidate processes 70/286270/2
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 3 Jan 2023 04:43:25 +0000 (04:43 +0000)
committerHwanKyu Jhun <h.jhun@samsung.com>
Tue, 3 Jan 2023 04:46:22 +0000 (04:46 +0000)
To initialize aul worker thread in the loader process,
the aul_launch_worker_init() is added.

Adds:
 - aul_launch_worker_init()
 - aul_launch_worker_fini()

Change-Id: I6d2707f16f7f82a0a98b79369c37b46909746eff
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
include/aul.h
src/aul_launch.c

index e031f1a7d67217b2c6a1fa84815a34c7000818a8..bbe7c24dbd154a3d52920cf6e43abdda00f6ebca 100644 (file)
@@ -3110,13 +3110,23 @@ int aul_set_auto_restart(bundle *b);
 /**
  * @remarks This function is only for App Framework internally.
  */
-int aul_unset_auto_restart();
+int aul_unset_auto_restart(void);
 
 /**
  * @remarks This function is only for App Framework internally.
  */
 int aul_package_pre_event_send(uid_t uid, bundle *b);
 
+/**
+ * @remarks This function is only for App Framework internally.
+ */
+int aul_launch_worker_init(void);
+
+/**
+ * @remarks This function is only for App Framework internally.
+ */
+void aul_launch_worker_fini(void);
+
 #ifdef __cplusplus
         }
 #endif
index e6a0d33dccf745b8ca795ef2ef6ff91180ea23e9..5938207f9aa14f3dc138a6532b238ccf1d23e1d4 100644 (file)
@@ -634,10 +634,7 @@ static void __finalize_context(void)
 
        __context.touch_argv_handler = false;
 
-       if (__context.worker) {
-               aul_worker_destroy(__context.worker);
-               __context.worker = NULL;
-       }
+       aul_launch_worker_fini();
 
        if (__context.tizen_context) {
                g_main_context_unref(__context.tizen_context);
@@ -701,8 +698,7 @@ static int __initialize_context(void)
        else
                __context.tizen_context = NULL;
 
-       __context.worker = aul_worker_create("aul+");
-       if (!__context.worker) {
+       if (aul_launch_worker_init() != AUL_R_OK) {
                __finalize_context();
                return AUL_R_ERROR;
        }
@@ -719,6 +715,27 @@ static int __initialize_context(void)
        return AUL_R_OK;
 }
 
+API int aul_launch_worker_init(void)
+{
+       if (__context.worker != NULL)
+               return AUL_R_OK;
+
+       __context.worker = aul_worker_create("aul+");
+       if (__context.worker == NULL)
+               return AUL_R_ERROR;
+
+       return AUL_R_OK;
+}
+
+API void aul_launch_worker_fini(void)
+{
+       if (__context.worker == NULL)
+               return;
+
+       aul_worker_destroy(__context.worker);
+       __context.worker = NULL;
+}
+
 API int aul_launch_init(aul_handler_fn callback, void *user_data)
 {
        int ret;