From 2acd355f8dc8e75b3a63b7b1dc079ebccb3a2701 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 23 May 2023 16:03:29 +0000 Subject: Give Tcl_CreateThread a TCL_HASH_TYPE (unsigned) stackSize parameter --- doc/Thread.3 | 2 +- generic/tcl.decls | 2 +- generic/tclDecls.h | 4 ++-- generic/tclEvent.c | 2 +- generic/tclInt.h | 2 +- unix/tclUnixThrd.c | 6 +++--- win/tclWinThrd.c | 8 ++++---- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/Thread.3 b/doc/Thread.3 index 2005c93..ac60230 100644 --- a/doc/Thread.3 +++ b/doc/Thread.3 @@ -69,7 +69,7 @@ This procedure will act as the \fBmain()\fR of the newly created thread. The specified \fIclientData\fR will be its sole argument. .AP ClientData clientData in Arbitrary information. Passed as sole argument to the \fIproc\fR. -.AP int stackSize in +.AP unsigned stackSize in The size of the stack given to the new thread. .AP int flags in Bitmask containing flags allowing the caller to modify behavior of diff --git a/generic/tcl.decls b/generic/tcl.decls index 2e5d7b4..77aeb84 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -1391,7 +1391,7 @@ declare 392 { } declare 393 { int Tcl_CreateThread(Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, - void *clientData, Tcl_Size stackSize, int flags) + void *clientData, TCL_HASH_TYPE stackSize, int flags) } # Introduced in 8.3.2 diff --git a/generic/tclDecls.h b/generic/tclDecls.h index f9b36ba..c19b2c0 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1198,7 +1198,7 @@ EXTERN void Tcl_MutexFinalize(Tcl_Mutex *mutex); /* 393 */ EXTERN int Tcl_CreateThread(Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, void *clientData, - Tcl_Size stackSize, int flags); + TCL_HASH_TYPE stackSize, int flags); /* 394 */ EXTERN Tcl_Size Tcl_ReadRaw(Tcl_Channel chan, char *dst, Tcl_Size bytesToRead); @@ -2479,7 +2479,7 @@ typedef struct TclStubs { int (*tcl_ProcObjCmd) (void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 390 */ void (*tcl_ConditionFinalize) (Tcl_Condition *condPtr); /* 391 */ void (*tcl_MutexFinalize) (Tcl_Mutex *mutex); /* 392 */ - int (*tcl_CreateThread) (Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, void *clientData, Tcl_Size stackSize, int flags); /* 393 */ + int (*tcl_CreateThread) (Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, void *clientData, TCL_HASH_TYPE stackSize, int flags); /* 393 */ Tcl_Size (*tcl_ReadRaw) (Tcl_Channel chan, char *dst, Tcl_Size bytesToRead); /* 394 */ Tcl_Size (*tcl_WriteRaw) (Tcl_Channel chan, const char *src, Tcl_Size srcLen); /* 395 */ Tcl_Channel (*tcl_GetTopChannel) (Tcl_Channel chan); /* 396 */ diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 41c8700..5501721 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -2060,7 +2060,7 @@ Tcl_CreateThread( Tcl_ThreadId *idPtr, /* Return, the ID of the thread */ Tcl_ThreadCreateProc *proc, /* Main() function of the thread */ void *clientData, /* The one argument to Main() */ - Tcl_Size stackSize, /* Size of stack for the new thread */ + TCL_HASH_TYPE stackSize, /* Size of stack for the new thread */ int flags) /* Flags controlling behaviour of the new * thread. */ { diff --git a/generic/tclInt.h b/generic/tclInt.h index 87b16a8..e40c5bc 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3329,7 +3329,7 @@ MODULE_SCOPE int TclCreateSocketAddress(Tcl_Interp *interp, const char **errorMsgPtr); MODULE_SCOPE int TclpThreadCreate(Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, void *clientData, - int stackSize, int flags); + TCL_HASH_TYPE stackSize, int flags); MODULE_SCOPE Tcl_Size TclpFindVariable(const char *name, Tcl_Size *lengthPtr); MODULE_SCOPE void TclpInitLibraryPath(char **valuePtr, TCL_HASH_TYPE *lengthPtr, Tcl_Encoding *encodingPtr); diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index 0c32b0d..c67495e 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -222,7 +222,7 @@ TclpThreadCreate( Tcl_ThreadId *idPtr, /* Return, the ID of the thread */ Tcl_ThreadCreateProc *proc, /* Main() function of the thread */ ClientData clientData, /* The one argument to Main() */ - int stackSize, /* Size of stack for the new thread */ + TCL_HASH_TYPE stackSize, /* Size of stack for the new thread */ int flags) /* Flags controlling behaviour of the new * thread. */ { @@ -236,7 +236,7 @@ TclpThreadCreate( #ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE if (stackSize != TCL_THREAD_STACK_DEFAULT) { - pthread_attr_setstacksize(&attr, stackSize); + pthread_attr_setstacksize(&attr, (size_t)stackSize); #ifdef TCL_THREAD_STACK_MIN } else { /* @@ -255,7 +255,7 @@ TclpThreadCreate( result = pthread_attr_getstacksize(&attr, &size); if (!result && (size < TCL_THREAD_STACK_MIN)) { - pthread_attr_setstacksize(&attr, (size_t) TCL_THREAD_STACK_MIN); + pthread_attr_setstacksize(&attr, (size_t)TCL_THREAD_STACK_MIN); } #endif /* TCL_THREAD_STACK_MIN */ } diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index e9d4e08..da9133f 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -204,7 +204,7 @@ TclpThreadCreate( Tcl_ThreadId *idPtr, /* Return, the ID of the thread. */ Tcl_ThreadCreateProc *proc, /* Main() function of the thread. */ ClientData clientData, /* The one argument to Main(). */ - int stackSize, /* Size of stack for the new thread. */ + TCL_HASH_TYPE stackSize, /* Size of stack for the new thread. */ int flags) /* Flags controlling behaviour of the new * thread. */ { @@ -223,11 +223,11 @@ TclpThreadCreate( */ #if defined(_MSC_VER) || defined(__MSVCRT__) - tHandle = (HANDLE) _beginthreadex(NULL, (unsigned) stackSize, + tHandle = (HANDLE) _beginthreadex(NULL, (unsigned)stackSize, (Tcl_ThreadCreateProc*) TclWinThreadStart, winThreadPtr, 0, (unsigned *)idPtr); #else - tHandle = CreateThread(NULL, (DWORD) stackSize, + tHandle = CreateThread(NULL, (DWORD)stackSize, TclWinThreadStart, winThreadPtr, 0, (LPDWORD)idPtr); #endif @@ -725,7 +725,7 @@ Tcl_ConditionWait( if (timePtr == NULL) { wtime = INFINITE; } else { - wtime = timePtr->sec * 1000 + timePtr->usec / 1000; + wtime = (DWORD)timePtr->sec * 1000 + (DWORD)timePtr->usec / 1000; } /* -- cgit v0.12