Thread support on DIgital-Unix (Tru64-Unix) 
Author Message
 Thread support on DIgital-Unix (Tru64-Unix)

Tcl 8.3b1 Bug:  Generated by Scriptics' bug entry form at
        http://www.*-*-*.com/
Responses to this post are encouraged.
------

Submitted by:  kazuro furukawa
OperatingSystem:  Digital Unix
OperatingSystemVersion:  4.0F
Machine:  Alpha Server
Extensions:  none
CustomShell:  none
Synopsis:  Thread support on DIgital-Unix (Tru64-Unix)

ReproducibleScript:
/configure --enable-threads
make test

ObservedBehavior:
Configuration and compilation fails if the thread support is enabled.

DesiredBehavior:
Successful test results.

Patch:
*** tcl.m4.org  Thu Dec 23 08:05:20 1999
--- tcl.m4      Tue Jan 11 19:38:11 2000
***************
*** 362,386 ****
        AC_DEFINE(_REENTRANT)
        AC_DEFINE(_THREAD_SAFE)

!       AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
!       if test "$tcl_ok" = "yes"; then
!           # The space is needed
!           THREADS_LIBS=" -lpthread"
        else
!           AC_CHECK_LIB(pthreads,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
            if test "$tcl_ok" = "yes"; then
                # The space is needed
!               THREADS_LIBS=" -lpthreads"
            else
!               AC_CHECK_LIB(c,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
!               if test "$tcl_ok" = "no"; then
!                   TCL_THREADS=0
!                   AC_MSG_WARN("Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...")
!               fi
            fi
        fi
      else
        TCL_THREADS=0
        AC_MSG_RESULT(no (default))
      fi
  ])
--- 362,394 ----
        AC_DEFINE(_REENTRANT)
        AC_DEFINE(_THREAD_SAFE)

!       # "&& test" cannot be replaced with "-a"
!       if test -f /usr/bin/uname && test "`/usr/bin/uname -s`" = "OSF1" ; then
!           # if compaq tru64, process later in SC_CONFIG_CFLAGS
!           # since it needs cflags modification
!           dothread=yes
        else
!           AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
            if test "$tcl_ok" = "yes"; then
                # The space is needed
!               THREADS_LIBS=" -lpthread"
            else
!               AC_CHECK_LIB(pthreads,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
!               if test "$tcl_ok" = "yes"; then
!                   # The space is needed
!                   THREADS_LIBS=" -lpthreads"
!               else
!                   AC_CHECK_LIB(c,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
!                   if test "$tcl_ok" = "no"; then
!                       TCL_THREADS=0
!                       AC_MSG_WARN("Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...")
!                   fi
!               fi
            fi
        fi
      else
        TCL_THREADS=0
+       dothread=no
        AC_MSG_RESULT(no (default))
      fi
  ])
***************
*** 840,845 ****
--- 848,870 ----
            DL_LIBS=""
            LDFLAGS=""
            LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+           if test "$dothread" = "yes" ; then
+               # see pthread_intro(3) for pthread support on osf1, k.furukawa
+               if test "$CC" != "gcc" -a `$CC -v 2>&1 | grep -c gcc` = "0" ; then
+                   # pthread with cc
+                   EXTRA_CFLAGS="-std1 -pthread"
+                   LDFLAGS="-pthread"
+               else
+                   # pthread with gcc
+                   EXTRA_CFLAGS="-D_THREAD_SAFE"
+                   LIBS='${LIBS} -lpthread -lmach -lexc -lc'
+               fi
+           else
+               if test "$CC" != "gcc" -a `$CC -v 2>&1 | grep -c gcc` = "0" ; then
+                   # full ansi with cc
+                   EXTRA_CFLAGS="-std1"
+               fi
+           fi
            ;;
        RISCos-*)
            SHLIB_CFLAGS="-G 0"

*** tclUnixThrd.c.org   Wed Aug 11 02:17:27 1999
--- tclUnixThrd.c       Tue Jan 11 15:47:52 2000
***************
*** 84,89 ****
--- 84,102 ----

      pthread_attr_init(&attr);
      pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
+
+ #ifdef __osf__
+     /*
+      * on alpha/tru64unix we need a larger stack to execute "regexp",
+      * which may consume 30k bytes, while the default per thread is 8k.
+      * even "unknown" procedure may seg-faults, since it uses "regexp".
+      * i don't know how much is optimal. simple test for the stack is
+      * "testthread send [testthread create] {regexp t t}" and more
+      * serious test seems to be http.test.  k.furukawa
+      */
+     pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN*32);
+ #endif /* __osf__ */
+
      if (pthread_create((pthread_t *)idPtr, &attr,
            (void * (*)())proc, (void *)clientData) &&
            pthread_create((pthread_t *)idPtr, NULL,

*** tclThreadTest.c.org Wed Dec 22 08:58:04 1999
--- tclThreadTest.c     Tue Jan 11 15:41:33 2000
***************
*** 493,499 ****
      Tcl_Channel errChannel;
      char *errorInfo, *script;
      char *argv[3];
!     char buf[10];
      sprintf(buf, "%ld", (long) Tcl_GetCurrentThread());

      errorInfo = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
--- 493,499 ----
      Tcl_Channel errChannel;
      char *errorInfo, *script;
      char *argv[3];
!     char buf[TCL_INTEGER_SPACE];
      sprintf(buf, "%ld", (long) Tcl_GetCurrentThread());

      errorInfo = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);

PatchFiles:
    tcl.m4
    tclUnixThrd.c
    tclThreadTest.c

Comments:
These patches are essentially the same as the one I submitted last april for 8.1b3.



Sun, 30 Jun 2002 03:00:00 GMT  
 Thread support on DIgital-Unix (Tru64-Unix)

Quote:

> Tcl 8.3b1 Bug:  Generated by Scriptics' bug entry form at
> Submitted by:  kazuro furukawa
> OperatingSystem:  Digital Unix
> Synopsis:  Thread support on DIgital-Unix (Tru64-Unix)

All the noted items were for the most part already added to
the current CVS.  I'll check again to see if something was
different (since I don't have Tru64 to test on).

--
   Jeffrey Hobbs                          The Tcl Guy
   jeffrey.hobbs at scriptics.com         Scriptics Corp.



Sun, 30 Jun 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Compaq (Digital) Fortran and COMPLEX*32 on Tru64 UNIX

2. Threads on Digital UNIX

3. Unix debugging tools that support threads

4. Inexpensive licence for Tru64 Unix ?

5. Compiling Ruby 1.6.7 on TRU64 Unix V4.0F

6. Accessing the assembler from Dec C++ on Alpha Tru64 Unix

7. Fortran compiler bundled with Tru64 Unix?

8. Building Python 2.2.1 for HP Tru64 UNIX V4.0F

9. BLT on Tru64 UNIX

10. zipfile and Tru64 UNIX

11. smalltalk on digital unix?

12. Regina 0.08 binaries for digital unix

 

 
Powered by phpBB® Forum Software