Android-x86
Fork
Faire un don

  • R/O
  • HTTP
  • SSH
  • HTTPS

system-extras: Commit

system/extras


Commit MetaInfo

Révisioncc1b0fba71b55dabf3a3a5d4d4f6e5c806b7db6c (tree)
l'heure2019-06-06 06:19:22
AuteurOliver Nguyen <olivernguyen@goog...>
Commiterandroid-build-merger

Message de Log

Merge "Do not create property_watch_loop thread for zygote" into qt-dev
am: 5c1ad00d4b

Change-Id: Idb1e40982b8aa0edd6e6f40b4f53d1793a6a8efb

Change Summary

Modification

--- a/toolchain-extras/profile-extras.cpp
+++ b/toolchain-extras/profile-extras.cpp
@@ -17,7 +17,9 @@
1717 #include <errno.h>
1818 #include <pthread.h>
1919 #include <signal.h>
20+#include <stdlib.h>
2021 #include <string.h>
22+#include <libgen.h> // For POSIX basename().
2123
2224 // Use _system_properties.h to use __system_property_wait_any()
2325 #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
@@ -84,6 +86,20 @@ __attribute__((constructor)) int init_profile_extras(void) {
8486 return -1;
8587 }
8688
89+ // Do not create thread running property_watch_loop for zygote (it can get
90+ // invoked as zygote or app_process). This check is only needed for the
91+ // platform, but can be done on any version after Android L, when
92+ // getprogname() was added.
93+#if defined(__ANDROID_API__) && __ANDROID_API__ >= __ANDROID_API_L__
94+ const char *prog_basename = basename(getprogname());
95+ if (strncmp(prog_basename, "zygote", strlen("zygote")) == 0) {
96+ return 0;
97+ }
98+ if (strncmp(prog_basename, "app_process", strlen("app_process")) == 0) {
99+ return 0;
100+ }
101+#endif
102+
87103 pthread_t thread;
88104 int error = pthread_create(&thread, nullptr, property_watch_loop, nullptr);
89105 if (error != 0) {
Afficher sur ancien navigateur de dépôt.