Bug 1129244 - [Nuwa] wrap pthread_mutex_trylock. r=thinker
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 04 Feb 2015 10:54:49 +0900
changeset 228555 f478222a61669bc2a3f6aa3d433bfe85329f038d
parent 228554 30cc8c82eb2106e7513e554797e2025f9bced37f
child 228556 9d052bbf89aa850327c457e17c929a7b4e7614f4
push id28264
push usercbook@mozilla.com
push dateWed, 11 Feb 2015 13:58:35 +0000
treeherdermozilla-central@38058cb42a0e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersthinker
bugs1129244
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1129244 - [Nuwa] wrap pthread_mutex_trylock. r=thinker
configure.in
mozglue/build/Nuwa.cpp
--- a/configure.in
+++ b/configure.in
@@ -7278,17 +7278,17 @@ if test -f "${srcdir}/${MOZ_BUILD_APP}/c
   rm -f $tmpscript
 fi
 
 dnl We need to wrap dlopen and related functions on Android because we use
 dnl our own linker.
 if test "$OS_TARGET" = Android; then
     MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
     if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
-        MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=pthread_create,--wrap=epoll_wait,--wrap=poll,--wrap=pthread_cond_timedwait,--wrap=pthread_cond_wait,--wrap=epoll_create,--wrap=epoll_ctl,--wrap=close,--wrap=pthread_key_create,--wrap=pthread_key_delete,--wrap=socketpair,--wrap=pthread_self,--wrap=pthread_mutex_lock,--wrap=pthread_join,--wrap=pipe,--wrap=pipe2"
+        MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=pthread_create,--wrap=epoll_wait,--wrap=poll,--wrap=pthread_cond_timedwait,--wrap=pthread_cond_wait,--wrap=epoll_create,--wrap=epoll_ctl,--wrap=close,--wrap=pthread_key_create,--wrap=pthread_key_delete,--wrap=socketpair,--wrap=pthread_self,--wrap=pthread_mutex_lock,--wrap=pthread_mutex_trylock,--wrap=pthread_join,--wrap=pipe,--wrap=pipe2"
     fi
     if test "$MOZ_WIDGET_TOOLKIT" = android; then
         MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
     fi
 fi
 
 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
 export MOZ_GLUE_WRAP_LDFLAGS
--- a/mozglue/build/Nuwa.cpp
+++ b/mozglue/build/Nuwa.cpp
@@ -52,16 +52,17 @@ int __real_epoll_wait(int epfd,
                       struct epoll_event *events,
                       int maxevents,
                       int timeout);
 int __real_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mtx);
 int __real_pthread_cond_timedwait(pthread_cond_t *cond,
                                   pthread_mutex_t *mtx,
                                   const struct timespec *abstime);
 int __real_pthread_mutex_lock(pthread_mutex_t *mtx);
+int __real_pthread_mutex_trylock(pthread_mutex_t *mtx);
 int __real_poll(struct pollfd *fds, nfds_t nfds, int timeout);
 int __real_epoll_create(int size);
 int __real_socketpair(int domain, int type, int protocol, int sv[2]);
 int __real_pipe2(int __pipedes[2], int flags);
 int __real_pipe(int __pipedes[2]);
 int __real_epoll_ctl(int aEpollFd, int aOp, int aFd, struct epoll_event *aEvent);
 int __real_close(int aFd);
 #pragma GCC visibility pop
@@ -1128,16 +1129,30 @@ extern "C" MFBT_API int
   }
   THREAD_FREEZE_POINT2_VIP();
 
   return rv;
 }
 
 
 extern "C" MFBT_API int
+__wrap_pthread_mutex_trylock(pthread_mutex_t *mtx) {
+  int rv = 0;
+
+  THREAD_FREEZE_POINT1();
+  if (freezePoint2) {
+    return rv;
+  }
+  rv = REAL(pthread_mutex_trylock)(mtx);
+  THREAD_FREEZE_POINT2();
+
+  return rv;
+}
+
+extern "C" MFBT_API int
 __wrap_pthread_mutex_lock(pthread_mutex_t *mtx) {
   int rv = 0;
 
   THREAD_FREEZE_POINT1();
   if (freezePoint2) {
     return rv;
   }
   rv = REAL(pthread_mutex_lock)(mtx);