diff options
author | das <das> | 2008-08-13 23:08:38 (GMT) |
---|---|---|
committer | das <das> | 2008-08-13 23:08:38 (GMT) |
commit | 403d0af61f5e408620c7f57e40ef2d209b37835f (patch) | |
tree | d26b89f6cbc0024e413b437aea2374bb1847d351 /unix/tclUnixThrd.c | |
parent | e48a13a4a47c8dabc6edd925ae0f0d7eef67e047 (diff) | |
download | tcl-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/tclUnixThrd.c')
-rw-r--r-- | unix/tclUnixThrd.c | 95 |
1 files changed, 1 insertions, 94 deletions
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 */ - /* *---------------------------------------------------------------------- * |