summaryrefslogtreecommitdiffstats
path: root/generic/tclThreadTest.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-01-02 14:30:30 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-01-02 14:30:30 (GMT)
commit8214e44b57a7ed7914a9d3eb4de78d298402edf0 (patch)
tree51f4f029ebd5893bc62dcc7b5f35078b6b9bf25c /generic/tclThreadTest.c
parentd967827b739973e53a0ca4e78ad873ee45949160 (diff)
parent3f4534b92ba967574dc4106bc346ccbbfed9d638 (diff)
downloadtcl-8214e44b57a7ed7914a9d3eb4de78d298402edf0.zip
tcl-8214e44b57a7ed7914a9d3eb4de78d298402edf0.tar.gz
tcl-8214e44b57a7ed7914a9d3eb4de78d298402edf0.tar.bz2
test Tcl_GetErrorLine() forwards/backwards compatibility in pkgb.so as well.
Marked some string subcommands as obsolete, following discussion on tcl-core. Don't free ctrl.script if thread creation fails: it is a constant string "testthread wait" normally.
Diffstat (limited to 'generic/tclThreadTest.c')
-rw-r--r--generic/tclThreadTest.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c
index 960c7dc..d032cc6 100644
--- a/generic/tclThreadTest.c
+++ b/generic/tclThreadTest.c
@@ -57,7 +57,7 @@ static struct ThreadSpecificData *threadList;
*/
typedef struct ThreadCtrl {
- char *script; /* The Tcl command this thread should
+ const char *script; /* The Tcl command this thread should
* execute */
int flags; /* Initial value of the "flags" field in the
* ThreadSpecificData structure for the new
@@ -120,11 +120,11 @@ EXTERN int TclThread_Init(Tcl_Interp *interp);
EXTERN int Tcl_ThreadObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-EXTERN int TclCreateThread(Tcl_Interp *interp, char *script,
+EXTERN int TclCreateThread(Tcl_Interp *interp, const char *script,
int joinable);
EXTERN int TclThreadList(Tcl_Interp *interp);
EXTERN int TclThreadSend(Tcl_Interp *interp, Tcl_ThreadId id,
- char *script, int wait);
+ const char *script, int wait);
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
@@ -234,7 +234,7 @@ Tcl_ThreadObjCmd(
switch ((enum options)option) {
case THREAD_CREATE: {
- char *script;
+ const char *script;
int joinable, len;
if (objc == 2) {
@@ -331,7 +331,7 @@ Tcl_ThreadObjCmd(
return TclThreadList(interp);
case THREAD_SEND: {
long id;
- char *script;
+ const char *script;
int wait, arg;
if ((objc != 4) && (objc != 5)) {
@@ -407,7 +407,7 @@ Tcl_ThreadObjCmd(
int
TclCreateThread(
Tcl_Interp *interp, /* Current interpreter. */
- char *script, /* Script to execute */
+ const char *script, /* Script to execute */
int joinable) /* Flag, joinable thread or not */
{
ThreadCtrl ctrl;
@@ -424,7 +424,6 @@ TclCreateThread(
TCL_THREAD_STACK_DEFAULT, joinable) != TCL_OK) {
Tcl_MutexUnlock(&threadMutex);
Tcl_AppendResult(interp, "can't create a new thread", NULL);
- ckfree((char *) ctrl.script);
return TCL_ERROR;
}
@@ -705,7 +704,7 @@ int
TclThreadSend(
Tcl_Interp *interp, /* The current interpreter. */
Tcl_ThreadId id, /* Thread Id of other interpreter. */
- char *script, /* The script to evaluate. */
+ const char *script, /* The script to evaluate. */
int wait) /* If 1, we block for the result. */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -1035,7 +1034,7 @@ ThreadExitProc(
* going to call free on it.
*/
- char *msg = "target thread died";
+ const char *msg = "target thread died";
resultPtr->result = ckalloc(strlen(msg)+1);
strcpy(resultPtr->result, msg);