summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authordas <das>2008-08-13 23:08:38 (GMT)
committerdas <das>2008-08-13 23:08:38 (GMT)
commit403d0af61f5e408620c7f57e40ef2d209b37835f (patch)
treed26b89f6cbc0024e413b437aea2374bb1847d351 /unix
parente48a13a4a47c8dabc6edd925ae0f0d7eef67e047 (diff)
downloadtcl-403d0af61f5e408620c7f57e40ef2d209b37835f.zip
tcl-403d0af61f5e408620c7f57e40ef2d209b37835f.tar.gz
tcl-403d0af61f5e408620c7f57e40ef2d209b37835f.tar.bz2
* unix/tclUnixThrd.c: remove unused TclpThreadGetStackSize()
* generic/tclInt.h: and related ifdefs and autoconf tests. * unix/tclUnixPort.h: [Bug 2017264] (jenglish) * unix/tcl.m4:
Diffstat (limited to 'unix')
-rw-r--r--unix/tcl.m437
-rw-r--r--unix/tclUnixPort.h20
-rw-r--r--unix/tclUnixThrd.c95
3 files changed, 2 insertions, 150 deletions
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 <pthread.h>?])
- 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 <pthread.h>?])
- 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 <pthread.h>
-# include <pthread_np.h>
-# 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 */
-
/*
*----------------------------------------------------------------------
*