OriginalBugID: 1931 Bug
Version: 8.1b3
SubmitDate: '1999-04-26'
LastModified: '2000-01-11'
Severity: SER
Status: Closed
Submitter: pat
ChangedBy: hobbs
RelatedBugIDs: 1966
OS: Digital Unix
OSVersion: 4.0B
Machine: Other
FixedDate: '2000-10-25'
ClosedDate: '2000-01-11'
Name:
kazuro furukawa
CVS:
Apr.23.1999.
Comments:
Since ThreadId is actually a pointer, threadid should be a long
instead of an int.
ReproducibleScript:
% set id [testthread create]
% testthread send $id {testthread id}
invalid thread id
(on 64bit machines)
ObservedBehavior:
thread-id's returned from testthread commands are wrong.
DesiredBehavior:
thread-id's should be usable.
Patch:
diff -u tclThreadTest.c.org tclThreadTest.c
--- tclThreadTest.c.org Fri Apr 16 09:46:54 1999
+++ tclThreadTest.c Sun Apr 25 09:04:20 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.1 1999/04/25 00:04:05 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;
}
@@ -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:
tclThreadTest.c
04/26/1999 14:46 - redman - Apply to 8.1.1. It seems like a reasonable patch. Need to verify that it would work and not break anything.
--
These are part of the fixes in 1966.
-- 01/11/2000 hobbs
|