Posted to tcl by miguel at Fri Jan 11 11:29:09 GMT 2008view raw

  1. Index: unix/tclUnixThrd.c
  2. ===================================================================
  3. RCS file: /cvsroot/tcl/tcl/unix/tclUnixThrd.c,v
  4. retrieving revision 1.56
  5. diff -u -r1.56 tclUnixThrd.c
  6. --- unix/tclUnixThrd.c 11 Jan 2008 10:54:49 -0000 1.56
  7. +++ unix/tclUnixThrd.c 11 Jan 2008 11:11:58 -0000
  8. @@ -223,16 +223,12 @@
  9. #if defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE) && defined(TclpPthreadGetAttrs)
  10. pthread_attr_t threadAttr; /* This will hold the thread attributes for
  11. * the current thread. */
  12. - static int initialized = 0;
  13. -
  14. /*
  15. * Fix for [Bug 1815573]
  16. *
  17. * DESCRIPTION:
  18. * On linux TclpPthreadGetAttrs (which is pthread_attr_get_np) may return
  19. - * bogus values on the initial thread. We have a choice: either use the
  20. - * default thread stack (first branch in the #if below), or return 0 and
  21. - * let getrlimit do its thing.
  22. + * bogus values on the initial thread.
  23. *
  24. * ASSUMPTIONS:
  25. * There seems to be no api to determine if we are on the initial
  26. @@ -247,14 +243,21 @@
  27. * second Tcl interp will be created only after the first call to
  28. * Tcl_CreateInterp returns.
  29. *
  30. - * These assumptions are satisfied by tclsh. Embedders may want to check
  31. - * their validity, and possibly adapt the code on failing to meet them.
  32. + * These assumptions are satisfied by tclsh. Embedders on linux may want
  33. + * to check their validity, and possibly adapt the code on failing to meet
  34. + * them.
  35. */
  36.  
  37. +#ifdef __GLIBC__
  38. + static int initialized = 0;
  39. +
  40. if (!initialized) {
  41. initialized = 1;
  42. return 0;
  43. } else {
  44. +#else
  45. + {
  46. +#endif
  47. if (pthread_attr_init(&threadAttr) != 0) {
  48. return -1;
  49. }