Hi,

That usleep is for checking if the application is launched, and the cmdline
of the launched application is changed well. It is executed in the amd_agent
(Launchpad) not in the application process. After the agent confirm that the
application is launched, it send result of the launch request to the
requester. 
It doesn't affect the startup time of an application.

> -----Original Message-----
> From: Dev [mailto:[email protected]] On Behalf Of Ilya Palachev
> Sent: Tuesday, November 11, 2014 2:15 AM
> To: [email protected]
> Cc: Andrew Senkevich
> Subject: [Dev] Current status of preloading_preinitializing_daemon in
> Tizen
> 
> Hi all,
> 
> What's the current status of preloading_preinitializing_daemon in Tizen?
> Are there any plans to enhance startup time of Tizen applications?
> 
> In ./am_session_agent/agent.c there is a code that does a 50 ms delay,
> that can happen e. g. 4 times during the startup of Phone application.
> This time can be critical.
> 
> _static_ void __send_result_to_caller(int clifd, int ret)
> {
>          char *cmdline;
>          int wait_count;
>          int cmdline_changed = 0;
>          int cmdline_exist = 0;
>          int r;
> 
>          if (clifd == -1)
>                  return;
> 
>          if (ret <= 1) {
>                  __real_send(clifd, ret);
>                  return;
>          }
>          /* check normally was launched?*/
>          wait_count = 1;
>          do {
>                  cmdline = __proc_get_cmdline_bypid(ret);
>                  if (cmdline == NULL) {
>                          _E("error founded when being launched with %d",
> ret);
> 
>                  } else if (strcmp(cmdline, agent_cmdline)) {
>                          free(cmdline);
>                          cmdline_changed = 1;
>                          break;
>                  } else {
>                          cmdline_exist = 1;
>                          free(cmdline);
>                  }
> 
>                  _D("-- now wait to change cmdline --");
>                  usleep(50 * 1000);      /* 50ms sleep*/
>                  wait_count++;
>          } while (wait_count <= 20);     /* max 50*20ms will be sleep*/
> 
>          if ((!cmdline_exist) && (!cmdline_changed)) {
>                  __real_send(clifd, -1); /* abnormally launched*/
>                  return;
>          }
> 
>          if (!cmdline_changed)
>                  _E("process launched, but cmdline not changed");
> 
>          _D("send_result_to_caller: %d",ret);
> 
>          if(__real_send(clifd, ret) < 0) {
>                  r = kill(ret, SIGKILL);
>                  if (r == -1)
>                          _E("send SIGKILL: %s", strerror(errno));
>          }
> 
>          return;
> }
> 
> Regards,
> Ilya
> _______________________________________________
> Dev mailing list
> [email protected]
> https://lists.tizen.org/listinfo/dev

_______________________________________________
Dev mailing list
[email protected]
https://lists.tizen.org/listinfo/dev

Reply via email to