From: Bart Van Assche Date: Wed, 2 Jun 2010 19:32:51 +0000 (+0000) Subject: Replaced dynamic initialization of DRD_(pthread_cond_initializer) by static initializ... X-Git-Tag: svn/VALGRIND_3_6_0~281 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0c39b2f5f3912c94e40f75b3c41a138689824d7;p=thirdparty%2Fvalgrind.git Replaced dynamic initialization of DRD_(pthread_cond_initializer) by static initialization. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11145 --- diff --git a/drd/Makefile.am b/drd/Makefile.am index f1c3eb3ade..663d2f5330 100644 --- a/drd/Makefile.am +++ b/drd/Makefile.am @@ -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 index 0000000000..ab041f080e --- /dev/null +++ b/drd/drd_cond_initializer.c @@ -0,0 +1,8 @@ +/* Make the value of PTHREAD_COND_INITIALIZER available to DRD. */ + +#include "drd_cond.h" +#include + +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); diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c index c414231a21..f3026edd3d 100644 --- a/drd/drd_pthread_intercepts.c +++ b/drd/drd_pthread_intercepts.c @@ -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: