diff options
author | das <das> | 2006-10-16 18:41:25 (GMT) |
---|---|---|
committer | das <das> | 2006-10-16 18:41:25 (GMT) |
commit | 500354bed1dd1c346a7638475fdd9a3c4be70184 (patch) | |
tree | e9f59b4bacf228f286426398eabb8b58a1505d0f /unix/tclUnixThrd.c | |
parent | 83ed8e2d6b100cc7247aea88a50772356195200e (diff) | |
download | tcl-500354bed1dd1c346a7638475fdd9a3c4be70184.zip tcl-500354bed1dd1c346a7638475fdd9a3c4be70184.tar.gz tcl-500354bed1dd1c346a7638475fdd9a3c4be70184.tar.bz2 |
* unix/tclUnixThrd.c (TclpThreadGetStackSize): Darwin: fix for main
thread, where pthread_get_stacksize_np() returns incorrect info.
* macosx/GNUmakefile: don't redo prebinding of non-prebound binaires.
Diffstat (limited to 'unix/tclUnixThrd.c')
-rw-r--r-- | unix/tclUnixThrd.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index 57795ab..adc508f 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -215,10 +215,10 @@ TclpThreadExit( int 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. */ - size_t stackSize; if (pthread_attr_init(&threadAttr) != 0) { return -1; @@ -232,17 +232,22 @@ TclpThreadGetStackSize(void) return -1; } pthread_attr_destroy(&threadAttr); - return (int) stackSize; #elif defined(HAVE_PTHREAD_GET_STACKSIZE_NP) - return (int) pthread_get_stacksize_np(pthread_self()); +#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. */ - - return 0; #endif + return (int) stackSize; } #endif /* TCL_THREADS */ |