2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 ///////////////////////////////////////////////////////////////////////////////
18 /// \ingroup tag_NSFramework
19 /// \brief Framework wrapper over the service directory interface APIs
23 ///////////////////////////////////////////////////////////////////////////////
28 #include <sys/prctl.h>
29 #include <sys/resource.h>
30 #include <sys/syscall.h>
32 #include <native_service/frameworkunified_dispatcher.h>
33 #include <native_service/frameworkunified_multithreading.h>
34 #include <native_service/ns_utility.hpp>
35 #include <native_service/ns_message_center_if.h>
36 #include <native_service/frameworkunified_framework_if.h>
37 #include <native_service/ns_system_mode.h>
38 #include <native_service/ns_logger_if.h>
39 #include <native_service/frameworkunified_sm_hsmframework.h>
40 #include <native_service/frameworkunified_sm_framework_dispatch.h>
44 #ifdef DISPATCHER_PROFILER
45 #include <boost/bind.hpp>
46 #include "frameworkunified_msgprofiler.h"
49 #include "frameworkunified_framework_core.h"
50 #include "frameworkunified_framework_utility.h"
51 #include "frameworkunified_framework_internal.h"
52 #include "frameworkunified_sm_multithreading_internal.h"
54 __thread HANDLE responseWaitQ = NULL;
56 ////////////////////////////////////////////////////////////////////////////////////////////
57 /// IsValidWaitBarrier
58 ////////////////////////////////////////////////////////////////////////////////////////////
59 bool IsValidWaitBarrier(int wbret) {
60 return (PTHREAD_BARRIER_SERIAL_THREAD == wbret) ||
64 ////////////////////////////////////////////////////////////////////////////////////////////
66 ////////////////////////////////////////////////////////////////////////////////////////////
67 EFrameworkunifiedStatus DestroyThread(HANDLE hApp) {
68 // terminates the dispatcher loop to destroy the thread
69 if (responseWaitQ != NULL) {
72 * The responseWaitQ is set in the FrameworkunifiedInvokeSync and is closed in the callback process (DestroyThread) of the FrameworkunifiedDestroyChildThread.
73 * Therefore, the responseWaitQ is not closed when FrameworkunifiedInvokeSync is used on the parent.
75 McClose(responseWaitQ);
78 return eFrameworkunifiedStatusExit;
81 ////////////////////////////////////////////////////////////////////////////////////////////
82 /// setChildThreadSched
83 ////////////////////////////////////////////////////////////////////////////////////////////
84 EFrameworkunifiedStatus setChildThreadSched(EFrameworkunifiedSchedPolicy policy, SI_32 priority) {
85 EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
86 struct sched_param param;
87 int get_policy, set_policy;
90 if (pthread_getschedparam(pthread_self(), &get_policy, ¶m) != 0) {
91 // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
92 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: pthread_getschedparam errno:%d", errno);
94 return eFrameworkunifiedStatusFail;
97 if (policy == eFrameworkunifiedSchedPolicyInherit) {
98 set_policy = get_policy;
100 if (policy == eFrameworkunifiedSchedPolicyFIFO) {
101 set_policy = SCHED_FIFO;
102 } else if (policy == eFrameworkunifiedSchedPolicyRR) {
103 set_policy = SCHED_RR;
105 set_policy = SCHED_OTHER;
109 if (priority == INHERIT_PARENT_THREAD_PRIO) {
110 if (get_policy != set_policy) {
111 FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning: Change policy(%d-%d) but inherit priority", get_policy, set_policy);
113 if (set_policy == SCHED_OTHER) {
116 set_priority = sched_get_priority_min(set_policy);
119 set_priority = param.sched_priority;
122 set_priority = priority;
125 switch (set_policy) {
127 param.sched_priority = 0;
128 if (pthread_setschedparam(pthread_self(), SCHED_OTHER, ¶m) != 0) {
129 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: pthread_setschedparam errno:%d", errno);
130 eStatus = eFrameworkunifiedStatusFail;
132 if (setpriority(PRIO_PROCESS, static_cast<int>(syscall(__NR_gettid)), set_priority) != 0) {
133 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: setpriority errno:%d", errno);
134 eStatus = eFrameworkunifiedStatusFail;
141 param.sched_priority = set_priority;
142 if (pthread_setschedparam(pthread_self(), set_policy, ¶m) != 0) {
143 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: pthread_setschedparam errno:%d", errno);
144 eStatus = eFrameworkunifiedStatusFail;
152 ////////////////////////////////////////////////////////////////////////////////////////////
153 /// child_thread_proc
154 ////////////////////////////////////////////////////////////////////////////////////////////
155 void *child_thread_proc(void *args) {
157 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "args is NULL");
160 PCData pcdata = *reinterpret_cast< PCData * >(args); // Create a local copy of data
163 EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
166 if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateDispatcherChild(hApp,
167 pcdata.childName.c_str(),
168 pcdata.parentName.c_str()))) {
169 // LCOV_EXCL_BR_START 200: If FrameworkunifiedCreateDispatcherChild return eFrameworkunifiedStatusOK, hApp would also be valid.
170 if (frameworkunifiedCheckValidAppHandle(hApp)) {
172 THApp hChildApp(hApp);
174 const FrameworkunifiedProtocolCallbackHandler pcbhs[] = { { SYSTEM_ON_INITIALIZATION, pcdata.initFn },
175 { SYSTEM_ON_SHUTDOWN, pcdata.shdnFn },
176 { SYSTEM_ON_DESTROY, DestroyThread }
177 }; // LCOV_EXCL_BR_LINE 11:except branch
179 if (eFrameworkunifiedStatusOK != FrameworkunifiedAttachCallbacksToDispatcher(hChildApp,
180 pcdata.parentName.c_str(),
182 static_cast<UI_32>(_countof(pcbhs)))) {
183 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
184 "Error: Attaching child callbacks to dispatcher %s", pcdata.childName.c_str());
187 char thread_name[16];
188 strncpy(thread_name, pcdata.childName.c_str(), sizeof(thread_name));
189 prctl(PR_SET_NAME, thread_name);
190 thread_name[15] = '\0';
192 setChildThreadSched(pcdata.schedPolicy, pcdata.schedPriority);
194 *pcdata.childStatus = eFrameworkunifiedStatusOK;
195 if (IsValidWaitBarrier(pthread_barrier_wait(pcdata.barrier))) {
196 RunChildDispatcher(hChildApp);
199 // LCOV_EXCL_START 200: If FrameworkunifiedCreateDispatcherChild return eFrameworkunifiedStatusOK, hApp would also be valid.
200 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
201 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hApp is NULL");
205 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateDispatcherChild error, status=%d", eStatus);
207 *pcdata.childStatus = eFrameworkunifiedStatusFail;
208 pthread_barrier_wait(pcdata.barrier);
210 } catch (const THApp::Exception &) {
211 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to create child %s", pcdata.childName.c_str());
217 ////////////////////////////////////////////////////////////////////////////////////////////
218 /// CreateChildThread
219 ////////////////////////////////////////////////////////////////////////////////////////////
220 HANDLE CreateChildThread(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize, CbFuncPtr CbShutdown,
221 const FrameworkunifiedChildThreadAttr *attr, CbFuncPtr CbCreateStateMachine) {
222 HANDLE hChildQ = NULL;
223 pthread_attr_t tAttr;
224 pthread_attr_t *pAttr = NULL;
225 SI_32 l_iThrCreate = 0;
226 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
228 if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && strlen(childName) < LIMIT_NAME_SIZE_APP &&
229 NULL != CbInitialize && NULL != CbShutdown && NULL != attr) {
230 if (attr->schedPolicy < eFrameworkunifiedSchedPolicyInherit || attr->schedPolicy >= eFrameworkunifiedSchedPolicyMAX) {
231 l_eStatus = eFrameworkunifiedStatusInvldParam;
233 if (EOK == pthread_attr_init(&tAttr)) {
234 if (EOK != pthread_attr_setinheritsched(&tAttr, PTHREAD_INHERIT_SCHED)) {
235 l_eStatus = eFrameworkunifiedStatusFail;
242 if (eFrameworkunifiedStatusOK == l_eStatus) {
243 pthread_barrier_t barrier;
244 if (EOK == pthread_barrier_init(&barrier, NULL, 2)) {
245 PCData pc(&barrier, &l_eStatus, FrameworkunifiedGetAppName(hApp), childName, CbInitialize, CbShutdown,
246 attr->schedPolicy, attr->schedPriority, CbCreateStateMachine);
247 pthread_t childThread = 0;
249 if (NULL != CbCreateStateMachine) {
250 l_iThrCreate = pthread_create(&childThread, pAttr, child_hsm_thread_proc, &pc);
252 l_iThrCreate = pthread_create(&childThread, pAttr, child_thread_proc, &pc);
255 if (EOK == l_iThrCreate) {
256 if (IsValidWaitBarrier(pthread_barrier_wait(&barrier))) {
257 if (eFrameworkunifiedStatusOK == l_eStatus) {
258 hChildQ = McOpenSenderChild(childName, childThread);
262 pthread_barrier_destroy(&barrier);
265 #ifdef DISPATCHER_PROFILER
266 if (TRUE == FrameworkunifiedMsgProfiler::m_bMsgProfilerEnabled) {
267 CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
268 if (NULL != pApp->m_pFrameworkunifiedMsgProfiler) {
269 pApp->m_pFrameworkunifiedMsgProfiler->AddChildName(childName);
277 ////////////////////////////////////////////////////////////////////////////////////////////
278 /// CreateChildThreadAttrInit
279 ////////////////////////////////////////////////////////////////////////////////////////////
280 EFrameworkunifiedStatus CreateChildThreadAttrInit(FrameworkunifiedChildThreadAttr *attr) {
281 EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
284 eStatus = eFrameworkunifiedStatusNullPointer;
286 memset(attr, 0, sizeof(FrameworkunifiedChildThreadAttr));
287 attr->schedPolicy = eFrameworkunifiedSchedPolicyInherit;
288 attr->schedPriority = INHERIT_PARENT_THREAD_PRIO;
294 ////////////////////////////////////////////////////////////////////////////////////////////
295 /// CreateChildThreadAttrSetSched
296 ////////////////////////////////////////////////////////////////////////////////////////////
297 EFrameworkunifiedStatus CreateChildThreadAttrSetSched(FrameworkunifiedChildThreadAttr *attr, EFrameworkunifiedSchedPolicy policy, SI_32 priority) {
298 EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
301 eStatus = eFrameworkunifiedStatusNullPointer;
303 if (policy < eFrameworkunifiedSchedPolicyInherit || policy >= eFrameworkunifiedSchedPolicyMAX) {
304 eStatus = eFrameworkunifiedStatusInvldParam;
306 attr->schedPolicy = policy;
307 attr->schedPriority = priority;
314 ////////////////////////////////////////////////////////////////////////////////////////////
315 /// FrameworkunifiedCreateChildThreadAttrInit
316 ////////////////////////////////////////////////////////////////////////////////////////////
317 EFrameworkunifiedStatus FrameworkunifiedCreateChildThreadAttrInit(FrameworkunifiedChildThreadAttr *attr) {
318 return CreateChildThreadAttrInit(attr);
321 ////////////////////////////////////////////////////////////////////////////////////////////
322 /// FrameworkunifiedCreateChildThreadAttrSetSched
323 ////////////////////////////////////////////////////////////////////////////////////////////
324 EFrameworkunifiedStatus FrameworkunifiedCreateChildThreadAttrSetSched(FrameworkunifiedChildThreadAttr *attr, EFrameworkunifiedSchedPolicy policy, SI_32 priority) {
325 return CreateChildThreadAttrSetSched(attr, policy, priority);
328 ////////////////////////////////////////////////////////////////////////////////////////////
329 /// FrameworkunifiedCreateChildThread
330 ////////////////////////////////////////////////////////////////////////////////////////////
331 HANDLE FrameworkunifiedCreateChildThread(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize
332 , CbFuncPtr CbShutdown) {
333 HANDLE hChildQ = NULL;
334 FrameworkunifiedChildThreadAttr attr;
336 if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && strlen(childName) < LIMIT_NAME_SIZE_APP &&
337 NULL != CbInitialize && NULL != CbShutdown) {
338 CreateChildThreadAttrInit(&attr);
339 hChildQ = CreateChildThread(hApp, childName, CbInitialize, CbShutdown, &attr, NULL);
345 ////////////////////////////////////////////////////////////////////////////////////////////
346 /// FrameworkunifiedCreateChildThreadWithPriority
347 ////////////////////////////////////////////////////////////////////////////////////////////
348 HANDLE FrameworkunifiedCreateChildThreadWithPriority(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize
349 , CbFuncPtr CbShutdown, SI_32 schedPrio) {
350 HANDLE hChildQ = NULL;
351 FrameworkunifiedChildThreadAttr attr;
353 if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && strlen(childName) < LIMIT_NAME_SIZE_APP &&
354 NULL != CbInitialize && NULL != CbShutdown) {
355 CreateChildThreadAttrInit(&attr);
356 CreateChildThreadAttrSetSched(&attr, eFrameworkunifiedSchedPolicyFIFO, schedPrio);
357 hChildQ = CreateChildThread(hApp, childName, CbInitialize, CbShutdown, &attr, NULL);
363 ////////////////////////////////////////////////////////////////////////////////////////////
364 /// FrameworkunifiedCreateChildThreadWithAttribute
365 ////////////////////////////////////////////////////////////////////////////////////////////
366 HANDLE FrameworkunifiedCreateChildThreadWithAttribute(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize
367 , CbFuncPtr CbShutdown, const FrameworkunifiedChildThreadAttr *attr) {
368 HANDLE hChildQ = NULL;
370 if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && strlen(childName) < LIMIT_NAME_SIZE_APP &&
371 NULL != CbInitialize && NULL != CbShutdown && NULL != attr) {
372 hChildQ = CreateChildThread(hApp, childName, CbInitialize, CbShutdown, attr, NULL);
379 ////////////////////////////////////////////////////////////////////////////////////////////
380 /// FrameworkunifiedDestroyChildThread
381 ////////////////////////////////////////////////////////////////////////////////////////////
382 EFrameworkunifiedStatus FrameworkunifiedDestroyChildThread(HANDLE hApp, HANDLE hChildQ) {
383 EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
385 if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != hChildQ) {
386 eStatus = FrameworkunifiedSendChild(hApp, hChildQ, PROTOCOL_THREAD_DESTROY, 0, NULL);
388 if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedJoinChild(hChildQ))) {
389 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedJoinChild Error. status: %d", eStatus);
392 // close the child message queue handle
393 eStatus = McClose(hChildQ);
396 eStatus = eFrameworkunifiedStatusInvldParam;
403 ////////////////////////////////////////////////////////////////////////////////////////////
404 /// FrameworkunifiedStartChildThread
405 ////////////////////////////////////////////////////////////////////////////////////////////
406 EFrameworkunifiedStatus FrameworkunifiedStartChildThread(HANDLE hApp, HANDLE hChildQ, UI_32 length, PCVOID data) {
407 return FrameworkunifiedSendChild(hApp, hChildQ, SYSTEM_ON_INITIALIZATION, length, data);
411 ////////////////////////////////////////////////////////////////////////////////////////////
412 /// FrameworkunifiedStopChildThread
413 ////////////////////////////////////////////////////////////////////////////////////////////
414 EFrameworkunifiedStatus FrameworkunifiedStopChildThread(HANDLE hApp, HANDLE hChildQ, UI_32 length, PCVOID data) {
415 return FrameworkunifiedSendChild(hApp, hChildQ, SYSTEM_ON_SHUTDOWN, length, data);
419 ////////////////////////////////////////////////////////////////////////////////////////////
420 /// FrameworkunifiedSendChild
421 ////////////////////////////////////////////////////////////////////////////////////////////
422 EFrameworkunifiedStatus FrameworkunifiedSendChild(HANDLE hApp, HANDLE hChildQ, UI_32 iCmd, UI_32 length, PCVOID data) {
423 if (frameworkunifiedCheckValidAppHandle(hApp)) {
424 CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hApp);
425 return McSend(hChildQ, &pApp->cAppName[ 0 ], iCmd, length, data);
427 return eFrameworkunifiedStatusInvldHandle;
431 ////////////////////////////////////////////////////////////////////////////////////////////
432 /// FrameworkunifiedSendParent
433 ////////////////////////////////////////////////////////////////////////////////////////////
434 EFrameworkunifiedStatus FrameworkunifiedSendParent(HANDLE hChildApp, UI_32 iCmd, UI_32 length, PCVOID data) {
435 if (frameworkunifiedCheckValidAppHandle(hChildApp)) {
436 CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hChildApp);
437 return McSend(pApp->hParentSndMsgQ, &pApp->cAppName[ 0 ], iCmd, length, data);
439 return eFrameworkunifiedStatusInvldHandle;
444 ////////////////////////////////////////////////////////////////////////////////////////////
445 /// FrameworkunifiedCreateDispatcherChild
446 ////////////////////////////////////////////////////////////////////////////////////////////
447 EFrameworkunifiedStatus FrameworkunifiedCreateDispatcherChild(HANDLE &hChildApp, // NOLINT (readability/nolint)
450 EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
452 if ((NULL != childName) && (NULL != parentName) && (LIMIT_NAME_SIZE_APP > strlen(parentName)) &&
453 (LIMIT_NAME_SIZE_APP > strlen(parentName))) {
454 if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateDispatcher(childName, hChildApp, TRUE))) {
455 // LCOV_EXCL_BR_START 200: If FrameworkunifiedCreateDispatcher return eFrameworkunifiedStatusOK, hChildApp would also be valid.
456 if (frameworkunifiedCheckValidAppHandle(hChildApp)) {
458 CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hChildApp);
460 memset(pApp->cParentAppName, 0, sizeof(pApp->cParentAppName));
461 memcpy(pApp->cParentAppName, parentName, strlen(parentName));
463 pApp->hParentSndMsgQ = McOpenSender(parentName);
464 if (NULL == pApp->hParentSndMsgQ) {
465 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "McOpenSender is NULL");
466 eStatus = eFrameworkunifiedStatusNullPointer;
469 pApp->uiSessionId = THREAD_SESSION_ID;
471 // LCOV_EXCL_START 200: If FrameworkunifiedCreateDispatcher return eFrameworkunifiedStatusOK, hChildApp would also be valid.
472 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
473 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hChildApp is NULL");
474 eStatus = eFrameworkunifiedStatusNullPointer;
478 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateDispatcher error, status=%d", eStatus);
481 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid parameter received");
482 eStatus = eFrameworkunifiedStatusInvldParam;
488 ////////////////////////////////////////////////////////////////////////////////////////////
489 /// FrameworkunifiedJoinChild
490 ////////////////////////////////////////////////////////////////////////////////////////////
491 EFrameworkunifiedStatus FrameworkunifiedJoinChild(HANDLE hChildApp) {
492 return McJoinChild(hChildApp);
495 ////////////////////////////////////////////////////////////////////////////////////////////
496 /// FrameworkunifiedGetChildThreadPriority
497 ////////////////////////////////////////////////////////////////////////////////////////////
498 EFrameworkunifiedStatus FrameworkunifiedGetChildThreadPriority(HANDLE hChildApp, PSI_32 threadPrio) {
499 return McGetChildThreadPriority(hChildApp, threadPrio);
502 EFrameworkunifiedStatus RunChildDispatcher(HANDLE hChildApp) {
503 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
505 // LCOV_EXCL_BR_START 6: RunChildDispatcher is a internal function, hChildApp would checked in child_thread_proc.
506 if (frameworkunifiedCheckValidAppHandle(hChildApp)) {
508 #ifdef DISPATCHER_PROFILER
509 // Get the application handle
510 CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hChildApp);
511 if (TRUE == FrameworkunifiedMsgProfiler::m_bMsgProfilerEnabled) {
512 pApp->m_pFrameworkunifiedMsgProfiler = new(std::nothrow) FrameworkunifiedMsgProfiler(FrameworkunifiedGetAppName(hChildApp));
513 if (NULL != pApp->m_pFrameworkunifiedMsgProfiler) {
514 FrameworkunifiedAttachChildMsgProfilerCallbacksDispatcher(hChildApp);
518 FrameworkunifiedGetDispatcherFD(hChildApp, &efd);
520 while (eFrameworkunifiedStatusExit != l_eStatus) {
521 l_eStatus = frameworkunifiedFdHandler(hChildApp, efd);
524 // LCOV_EXCL_START 6: RunChildDispatcher is a internal function, hChildApp would checked in child_thread_proc.
525 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
526 l_eStatus = eFrameworkunifiedStatusInvldHandle;