]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Replaced dynamic initialization of DRD_(pthread_cond_initializer) by static initializ...
authorBart Van Assche <bvanassche@acm.org>
Wed, 2 Jun 2010 19:32:51 +0000 (19:32 +0000)
committerBart Van Assche <bvanassche@acm.org>
Wed, 2 Jun 2010 19:32:51 +0000 (19:32 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11145

drd/Makefile.am
drd/drd_cond_initializer.c [new file with mode: 0644]
drd/drd_pthread_intercepts.c

index f1c3eb3ade4d9f650f025eb5b33cb04e89775818..663d2f533023c949da0516cb687c5692e4b33d02 100644 (file)
@@ -56,6 +56,7 @@ DRD_SOURCES_COMMON =    \
   drd_clientobj.c       \
   drd_clientreq.c       \
   drd_cond.c            \
+  drd_cond_initializer.c \
   drd_error.c           \
   drd_hb.c              \
   drd_load_store.c      \
diff --git a/drd/drd_cond_initializer.c b/drd/drd_cond_initializer.c
new file mode 100644 (file)
index 0000000..ab041f0
--- /dev/null
@@ -0,0 +1,8 @@
+/* Make the value of PTHREAD_COND_INITIALIZER available to DRD. */
+
+#include "drd_cond.h"
+#include <pthread.h>
+
+static pthread_cond_t pthread_cond_initializer = PTHREAD_COND_INITIALIZER;
+Addr DRD_(pthread_cond_initializer) = (Addr)&pthread_cond_initializer;
+int DRD_(pthread_cond_initializer_size) = sizeof(pthread_cond_initializer);
index c414231a214ad667479c60453d415b6f25b18d37..f3026edd3dfc2aa6f220888a856d9ff8ec611b68 100644 (file)
@@ -134,7 +134,6 @@ typedef struct
 static void DRD_(init)(void) __attribute__((constructor));
 static void DRD_(check_threading_library)(void);
 static void DRD_(set_main_thread_state)(void);
-static void DRD_(set_pthread_cond_initializer)(void);
 
 
 /* Function definitions. */
@@ -153,7 +152,6 @@ static void DRD_(init)(void)
 {
    DRD_(check_threading_library)();
    DRD_(set_main_thread_state)();
-   DRD_(set_pthread_cond_initializer)();
 }
 
 /**
@@ -343,21 +341,6 @@ static void DRD_(set_main_thread_state)(void)
                               pthread_self(), 0, 0, 0, 0);
 }
 
-/** Tell DRD which value PTHREAD_COND_INITIALIZER has. */
-static void DRD_(set_pthread_cond_initializer)(void)
-{
-   int res;
-
-   static pthread_cond_t pthread_cond_initializer = PTHREAD_COND_INITIALIZER;
-
-   // Make sure that DRD knows about the main thread's POSIX thread ID.
-   VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__SET_PTHREAD_COND_INITIALIZER,
-                              &pthread_cond_initializer,
-                              sizeof(pthread_cond_initializer),
-                              0, 0, 0);
-}
-
-
 /*
  * Note: as of today there exist three different versions of pthread_create
  * in Linux: