%define tizen_feature_priority_change 0
%define tizen_feature_loader_priority 0
-%ifarch armv7l i586
+%ifarch armv7l i686 i586
%define tizen_arch32 1
%else
%define tizen_arch32 0
%endif
+%ifarch x86_64 i686 i586
+%define tizen_emulator 1
+%else
+%define tizen_emulator 0
+%endif
+
%if "%{?_prelink_enable}" == "y"
%define tizen_feature_prelink 1
%else
_TIZEN_FEATURE_PRELINK=ON
%endif
+%if 0%{?tizen_emulator}
+HW_LOADER_THREADS=7
+%else
+HW_LOADER_THREADS=8
+%endif
+
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
%cmake -DVERSION=%{version} \
-DMAJORVER=${MAJORVER} \
+ -DHW_LOADER_THREADS=${HW_LOADER_THREADS} \
-D_TIZEN_FEATURE_PRIORITY_CHANGE:BOOL=${_TIZEN_FEATURE_PRIORITY_CHANGE} \
-D_TIZEN_FEATURE_LOADER_PRIORITY:BOOL=${_TIZEN_FEATURE_LOADER_PRIORITY} \
-D_TIZEN_FEATURE_SET_PERSONALITY_32:BOOL=${_TIZEN_FEATURE_SET_PERSONALITY_32} \
*/
#define _GNU_SOURCE
+#include <dirent.h>
+#include <malloc.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sys/prctl.h>
#include <sys/socket.h>
-#include <unistd.h>
#include <sys/types.h>
-#include <sys/prctl.h>
-#include <malloc.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
#include <bundle_internal.h>
#include <aul.h>
#include <security-manager.h>
#include <buxton2.h>
#include <vconf.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
#include "launchpad.h"
#include "launchpad_common.h"
#include "launchpad_types.h"
setenv("LC_CTYPE", region, 1);
}
+#ifndef USE_STATUS
+static unsigned int __get_thread_count(void)
+{
+ DIR *dp;
+ struct dirent *dentry;
+ unsigned int count = 0;
+
+ dp = opendir("/proc/self/task");
+ if (dp == NULL) {
+ _E("opendir() is failed. errno(%d)", errno);
+ return 0;
+ }
+
+ while ((dentry = readdir(dp)) != NULL) {
+ if (!isdigit(dentry->d_name[0]))
+ continue;
+
+ count++;
+ }
+
+ closedir(dp);
+ return count;
+}
+#else
+static unsigned int __get_thread_count(void)
+{
+ unsigned int count = 0;
+ char line[LINE_MAX];
+ FILE *fp;
+
+ fp = fopen("/proc/self/status", "r");
+ if (fp == NULL) {
+ _E("fopen() is failed");
+ return 0;
+ }
+
+ while (fgets(line, sizeof(line), fp)) {
+ if (sscanf(line, "Threads: %u", &count) == 1)
+ break;
+ }
+
+ fclose(fp);
+ return count;
+}
+#endif
+
+static void __wait_for_threads(unsigned int threads)
+{
+ unsigned int thread_count;
+
+ if (threads <= 1)
+ return;
+
+ _W("Thread count = %u", threads);
+ do {
+ thread_count = __get_thread_count();
+ _D("Current thread count = %u", thread_count);
+ if (thread_count >= threads)
+ break;
+
+ usleep(50 * 1000);
+ } while (threads != thread_count);
+ _E("Threads(%u) are ready", thread_count);
+}
+
static int __before_loop(int argc, char **argv)
{
int client_fd;
int ret = -1;
bundle *extra = NULL;
+ const char *val;
+ unsigned int threads = 0;
int r;
if (_verify_proc_caps() < 0)
}
if (__loader_callbacks->create) {
+ val = bundle_get_val(extra, "threads");
+ if (val && isdigit(val[0])) {
+ _D("threads: %s", val);
+ threads = atoi(val);
+ }
+
__loader_callbacks->create(extra, __loader_type,
__loader_user_data);
ret = 0;
+ aul_launch_worker_init();
+ __wait_for_threads(threads);
}
if (extra)
if (r != VCONF_OK)
_E("Failed to register callback for regionformat. error(%d)", r);
- aul_launch_worker_init();
-
return ret;
}