From 403d0af61f5e408620c7f57e40ef2d209b37835f Mon Sep 17 00:00:00 2001 From: das Date: Wed, 13 Aug 2008 23:08:38 +0000 Subject: * unix/tclUnixThrd.c: remove unused TclpThreadGetStackSize() * generic/tclInt.h: and related ifdefs and autoconf tests. * unix/tclUnixPort.h: [Bug 2017264] (jenglish) * unix/tcl.m4: --- ChangeLog | 16 +++++++++ generic/tclInt.h | 3 +- unix/tcl.m4 | 37 --------------------- unix/tclUnixPort.h | 20 +----------- unix/tclUnixThrd.c | 95 +----------------------------------------------------- 5 files changed, 19 insertions(+), 152 deletions(-) diff --git a/ChangeLog b/ChangeLog index b48007d..e02c752 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2008-08-14 Daniel Steffen + + * unix/tclUnixThrd.c: remove unused TclpThreadGetStackSize() + * generic/tclInt.h: and related ifdefs and autoconf tests. + * unix/tclUnixPort.h: [Bug 2017264] (jenglish) + * unix/tcl.m4: + + * unix/Makefile.in: ensure Makefile shell is /bin/bash for + * unix/configure.in (SunOS): DTrace-enabled build on Solaris. + (followup to 2008-06-12) [Bug 2016584] + + * unix/tcl.m4 (SC_PATH_X): check for libX11.dylib in addition to + libX11.so et al. + + * unix/configure: autoconf-2.59 + 2008-08-13 Miguel Sofer * tests/nre.test: added test for large {*}-expansion effects diff --git a/generic/tclInt.h b/generic/tclInt.h index 5b8f104..8992044 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.389 2008/08/07 04:13:52 msofer Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.390 2008/08/13 23:08:38 das Exp $ */ #ifndef _TCLINT @@ -2759,7 +2759,6 @@ MODULE_SCOPE void * TclThreadStorageKeyGet(Tcl_ThreadDataKey *keyPtr); MODULE_SCOPE void TclThreadStorageKeySet(Tcl_ThreadDataKey *keyPtr, void *data); MODULE_SCOPE void TclpThreadExit(int status); -MODULE_SCOPE size_t TclpThreadGetStackSize(void); MODULE_SCOPE void TclRememberCondition(Tcl_Condition *mutex); MODULE_SCOPE void TclRememberJoinableThread(Tcl_ThreadId id); MODULE_SCOPE void TclRememberMutex(Tcl_Mutex *mutex); diff --git a/unix/tcl.m4 b/unix/tcl.m4 index c7a13c6..c5be8f0 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -676,44 +676,7 @@ AC_DEFUN([SC_ENABLE_THREADS], [ # Does the pthread-implementation provide # 'pthread_attr_setstacksize' ? - - ac_saved_libs=$LIBS - LIBS="$LIBS $THREADS_LIBS" AC_CHECK_FUNCS(pthread_attr_setstacksize) - AC_CHECK_FUNC(pthread_attr_get_np,tcl_ok=yes,tcl_ok=no) - if test $tcl_ok = yes ; then - AC_DEFINE(HAVE_PTHREAD_ATTR_GET_NP, 1, - [Do we want a BSD-like thread-attribute interface?]) - AC_CACHE_CHECK([for pthread_attr_get_np declaration], - tcl_cv_grep_pthread_attr_get_np, [ - AC_EGREP_HEADER(pthread_attr_get_np, pthread.h, - tcl_cv_grep_pthread_attr_get_np=present, - tcl_cv_grep_pthread_attr_get_np=missing)]) - if test $tcl_cv_grep_pthread_attr_get_np = missing ; then - AC_DEFINE(ATTRGETNP_NOT_DECLARED, 1, - [Is pthread_attr_get_np() declared in ?]) - fi - else - AC_CHECK_FUNC(pthread_getattr_np,tcl_ok=yes,tcl_ok=no) - if test $tcl_ok = yes ; then - AC_DEFINE(HAVE_PTHREAD_GETATTR_NP, 1, - [Do we want a Linux-like thread-attribute interface?]) - AC_CACHE_CHECK([for pthread_getattr_np declaration], - tcl_cv_grep_pthread_getattr_np, [ - AC_EGREP_HEADER(pthread_getattr_np, pthread.h, - tcl_cv_grep_pthread_getattr_np=present, - tcl_cv_grep_pthread_getattr_np=missing)]) - if test $tcl_cv_grep_pthread_getattr_np = missing ; then - AC_DEFINE(GETATTRNP_NOT_DECLARED, 1, - [Is pthread_getattr_np declared in ?]) - fi - fi - fi - if test $tcl_ok = no; then - # Darwin thread stacksize API - AC_CHECK_FUNCS(pthread_get_stacksize_np) - fi - LIBS=$ac_saved_libs else TCL_THREADS=0 fi diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index f925b49..8fc6574 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -19,7 +19,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixPort.h,v 1.66 2008/05/02 10:27:04 dkf Exp $ + * RCS: @(#) $Id: tclUnixPort.h,v 1.67 2008/08/13 23:08:38 das Exp $ */ #ifndef _TCLUNIXPORT @@ -602,24 +602,6 @@ EXTERN char * TclpInetNtoa(struct in_addr); * #define gmtime(x) TclpGmtime(x) */ # undef inet_ntoa # define inet_ntoa(x) TclpInetNtoa(x) -# ifdef HAVE_PTHREAD_ATTR_GET_NP -# define TclpPthreadGetAttrs pthread_attr_get_np -# ifdef ATTRGETNP_NOT_DECLARED -/* - * Assume it is in pthread_np.h if it isn't in pthread.h. [Bug 1064882] - * We might need to revisit this in the future. :^( - */ -# include -# include -# endif -# else -# ifdef HAVE_PTHREAD_GETATTR_NP -# define TclpPthreadGetAttrs pthread_getattr_np -# ifdef GETATTRNP_NOT_DECLARED -EXTERN int pthread_getattr_np _ANSI_ARGS_((pthread_t, pthread_attr_t *)); -# endif -# endif /* HAVE_PTHREAD_GETATTR_NP */ -# endif /* HAVE_PTHREAD_ATTR_GET_NP */ #endif /* TCL_THREADS */ /* diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index d122f41..eac1bc8 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixThrd.c,v 1.59 2008/07/24 21:54:42 nijtmans Exp $ + * RCS: @(#) $Id: tclUnixThrd.c,v 1.60 2008/08/13 23:08:39 das Exp $ */ #include "tclInt.h" @@ -200,99 +200,6 @@ TclpThreadExit( } #endif /* TCL_THREADS */ -#ifdef TCL_THREADS -/* - *---------------------------------------------------------------------- - * - * TclpThreadGetStackSize -- - * - * This procedure returns the size of the current thread's stack. - * - * Results: - * Stack size (in bytes?) or -1 for error or 0 for undeterminable. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -size_t -TclpThreadGetStackSize(void) -{ - size_t stackSize = 0; -#if defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE) && defined(TclpPthreadGetAttrs) - pthread_attr_t threadAttr; /* This will hold the thread attributes for - * the current thread. */ -#ifdef __GLIBC__ - /* - * Fix for [Bug 1815573] - * - * DESCRIPTION: - * On linux TclpPthreadGetAttrs (which is pthread_attr_get_np) may return - * bogus values on the initial thread. - * - * ASSUMPTIONS: - * There seems to be no api to determine if we are on the initial - * thread. The simple scheme implemented here assumes: - * 1. The first Tcl interp to be created lives in the initial thread. If - * this assumption is not true, the fix is to call - * TclpThreadGetStackSize from the initial thread previous to - * creating any Tcl interpreter. In this case, especially if another - * Tcl interpreter may be created in the initial thread, it might be - * better to enable the second branch in the #if below - * 2. There will be no races in creating the first Tcl interp - ie, the - * second Tcl interp will be created only after the first call to - * Tcl_CreateInterp returns. - * - * These assumptions are satisfied by tclsh. Embedders on linux may want - * to check their validity, and possibly adapt the code on failing to meet - * them. - */ - - static int initialized = 0; - - if (!initialized) { - initialized = 1; - return 0; - } else { -#else - { -#endif - if (pthread_attr_init(&threadAttr) != 0) { - return -1; - } - if (TclpPthreadGetAttrs(pthread_self(), &threadAttr) != 0) { - pthread_attr_destroy(&threadAttr); - return (size_t)-1; - } - } - - - if (pthread_attr_getstacksize(&threadAttr, &stackSize) != 0) { - pthread_attr_destroy(&threadAttr); - return (size_t)-1; - } - pthread_attr_destroy(&threadAttr); -#elif defined(HAVE_PTHREAD_GET_STACKSIZE_NP) -#ifdef __APPLE__ - /* - * On Darwin, the API below does not return the correct stack size for the - * main thread (which is not a real pthread), so fallback to getrlimit(). - */ - if (!pthread_main_np()) -#endif - stackSize = pthread_get_stacksize_np(pthread_self()); -#else - /* - * Cannot determine the real stack size of this thread. The caller might - * want to try looking at the process accounting limits instead. - */ -#endif - return stackSize; -} -#endif /* TCL_THREADS */ - /* *---------------------------------------------------------------------- * -- cgit v0.12