Artifacts Associated With Ticket 218742
Ticket change [0f4795c9b3] (rid 94760) by nobody on 2000-10-26 01:04:49:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 1966 Bug Version: 8.1b3 SubmitDate: '1999-04-30' LastModified: '2000-01-11' Severity: SER Status: Released Submitter: pat ChangedBy: hobbs RelatedBugIDs: 1931 OS: Digital Unix OSVersion: 4.0B Machine: Other FixedDate: '2000-01-11' FixedInVersion: 8.3b2 ClosedDate: '2000-10-25' Name: kazuro furukawa Comments: (this patch includes a patch submitted on apr.24.1999.) + for compilation flags on du, see pthread_intro(3). + thread id should be 64bit. ReproducibleScript: testthread send [testthread create] {regexp t t} Segmentation fault ObservedBehavior: on digital-unix/tru64unix, thread in tcl seg-faults in regexec routines. DesiredBehavior: no seg-faults Patch: --- unix/configure.in.org Tue Apr 27 20:51:53 1999 +++ unix/configure.in Sat May 1 07:00:04 1999 @@ -2,7 +2,7 @@ dnl generate the file "configure", which is run during Tcl installation dnl to configure the system for the local environment. AC_INIT(../generic/tcl.h) -# RCS: @(#) $Id: configure.in,v 1.33 1999/04/24 01:46:54 stanton Exp $ +# RCS: @(#) $Id: configure.in,v 1.1 1999/04/30 21:59:49 furukawa Exp furukawa $ TCL_VERSION=8.1 TCL_MAJOR_VERSION=8 @@ -44,8 +44,10 @@ else 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 + dothread=yes else AC_MSG_RESULT(Will compile without Threads support (normal)) + dothread=no fi # set the warning flags depending on whether or not we are using gcc @@ -990,6 +992,16 @@ DL_LIBS="" LD_FLAGS="" LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + # see pthread_intro(3) for pthread support on osf1, k.furukawa + if test "$dothread" = "yes" ; then + if test "$CC" != "gcc" -a `$CC -v 2>&1 | grep -c gcc` = "0" ; then + EXTRA_CFLAGS="-std1 -pthread" + LD_FLAGS="-pthread" + else + EXTRA_CFLAGS="-D_THREAD_SAFE" + LIBS='${LIBS} -lpthread -lmach -lexc -lc' + fi + fi ;; RISCos-*) SHLIB_CFLAGS="-G 0" --- unix/tclUnixThrd.c.org Fri Apr 16 09:48:05 1999 +++ unix/tclUnixThrd.c Sat May 1 07:06:19 1999 @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tclUnixThrd.c 1.18 98/02/19 14:24:12 + * RCS: @(#) $Id: tclUnixThrd.c,v 1.2 1999/04/30 22:06:07 furukawa Exp furukawa $ */ #include "tclInt.h" @@ -75,6 +75,19 @@ 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) < 0) { return TCL_ERROR; } else { --- generic/tclThreadTest.c.org Fri Apr 16 09:46:54 1999 +++ generic/tclThreadTest.c Fri Apr 30 16:13:59 1999 @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclThreadTest.c,v 1.2 1999/04/16 00:46:54 stanton Exp $ + * RCS: @(#) $Id: tclThreadTest.c,v 1.2 1999/04/27 06:43:20 furukawa Exp furukawa $ */ #include "tclInt.h" @@ -253,7 +253,7 @@ } case THREAD_ID: if (objc == 2) { - Tcl_Obj *idObj = Tcl_NewIntObj((int)Tcl_GetCurrentThread()); + Tcl_Obj *idObj = Tcl_NewLongObj((long)Tcl_GetCurrentThread()); Tcl_SetObjResult(interp, idObj); return TCL_OK; } else { @@ -268,7 +268,7 @@ return TclThreadList(interp); } case THREAD_SEND: { - int id; + long id; char *script; int wait, arg; @@ -287,7 +287,7 @@ wait = 1; arg = 2; } - if (Tcl_GetIntFromObj(interp, objv[arg], &id) != TCL_OK) { + if (Tcl_GetLongFromObj(interp, objv[arg], &id) != TCL_OK) { return TCL_ERROR; } arg++; @@ -371,7 +371,7 @@ Tcl_ConditionWait(&ctrl.condWait, &threadMutex, NULL); Tcl_MutexUnlock(&threadMutex); TclFinalizeCondition(&ctrl.condWait); - Tcl_SetObjResult(interp, Tcl_NewIntObj((int)id)); + Tcl_SetObjResult(interp, Tcl_NewLongObj((long)id)); return TCL_OK; } @@ -487,7 +487,7 @@ Tcl_Channel errChannel; char *errorInfo, *script; char *argv[3]; - char buf[10]; + char buf[20]; sprintf(buf, "%ld", (long) Tcl_GetCurrentThread()); errorInfo = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY); @@ -604,7 +604,7 @@ Tcl_MutexLock(&threadMutex); for (tsdPtr = threadList ; tsdPtr ; tsdPtr = tsdPtr->nextPtr) { Tcl_ListObjAppendElement(interp, listPtr, - Tcl_NewIntObj((int)tsdPtr->threadId)); + Tcl_NewLongObj((long)tsdPtr->threadId)); } Tcl_MutexUnlock(&threadMutex); Tcl_SetObjResult(interp, listPtr); PatchFiles: unix/configure.in unix/tclUnixThrd.c generic/tclThreadTest.c The above fixes have been made (with mods where necessary) for 8.3b2. A slight modification was made for setting the stack size, so that the user can set the value from the makefile. However, the user must set TCL_THREAD_STACK_MIN to something to get the stack setting behavior (it leaves it to the defaults otherwise). See tclUnixThrd.c in 8.3b2 for more. This may be better parametrized in the future (runtime option?). -- 01/11/2000 hobbs - foundin initialized to: "obsolete: 8.1b3"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "49. Threading"
- title initialized to: "thread support on digital-unix"
- type initialized to: "Bug"
Ticket change [26e8c06779] (rid 88427) by welch on 2000-10-26 08:28:13:
- closedate changed to: "2000-10-26T01:28:13"
- closer changed to: "welch"
- priority changed to: "2"
- resolution changed to: "Fixed"
- status changed to: "Closed"