diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tcl.h | 23 | ||||
-rw-r--r-- | generic/tclThreadTest.c | 19 |
2 files changed, 27 insertions, 15 deletions
diff --git a/generic/tcl.h b/generic/tcl.h index 42b488e..3e49b10 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tcl.h,v 1.68 2000/04/13 02:30:43 hobbs Exp $ + * RCS: @(#) $Id: tcl.h,v 1.69 2000/04/17 20:32:21 welch Exp $ */ #ifndef _TCL @@ -395,10 +395,31 @@ typedef struct Tcl_Var_ *Tcl_Var; #ifdef MAC_TCL typedef pascal void *(Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData)); +#elif defined __WIN32__ +typedef unsigned (__stdcall Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData)); #else typedef void (Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData)); #endif + +/* + * Threading function return types used for abstracting away platform + * differences when writing a Tcl_ThreadCreateProc. See the NewThread + * function in generic/tclThreadTest.c for it's usage. + */ +#ifdef MAC_TCL +# define Tcl_ThreadCreateType pascal void * +# define TCL_THREAD_CREATE_RETURN return NULL +#elif defined __WIN32__ +# define Tcl_ThreadCreateType unsigned __stdcall +# define TCL_THREAD_CREATE_RETURN return 0 +#else +# define Tcl_ThreadCreateType void +# define TCL_THREAD_CREATE_RETURN +#endif + + + /* * Definition of values for default stacksize and the possible flags to be * given to Tcl_CreateThread. diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index d548423..2ef43bc 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -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.8 2000/04/09 16:04:19 kupries Exp $ + * RCS: @(#) $Id: tclThreadTest.c,v 1.9 2000/04/17 20:32:22 welch Exp $ */ #include "tclInt.h" @@ -126,11 +126,7 @@ EXTERN int TclThreadSend _ANSI_ARGS_((Tcl_Interp *interp, Tcl_ThreadId id, #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT -#ifdef MAC_TCL -static pascal void *NewThread _ANSI_ARGS_((ClientData clientData)); -#else -static void NewThread _ANSI_ARGS_((ClientData clientData)); -#endif +Tcl_ThreadCreateType NewThread _ANSI_ARGS_((ClientData clientData)); static void ListRemove _ANSI_ARGS_((ThreadSpecificData *tsdPtr)); static void ListUpdateInner _ANSI_ARGS_((ThreadSpecificData *tsdPtr)); static int ThreadEventProc _ANSI_ARGS_((Tcl_Event *evPtr, int mask)); @@ -406,11 +402,7 @@ TclCreateThread(interp, script) * *------------------------------------------------------------------------ */ -#ifdef MAC_TCL -static pascal void * -#else -static void -#endif +Tcl_ThreadCreateType NewThread(clientData) ClientData clientData; { @@ -467,9 +459,8 @@ NewThread(clientData) Tcl_Release((ClientData) tsdPtr->interp); Tcl_DeleteInterp(tsdPtr->interp); Tcl_ExitThread(result); -#ifdef MAC_TCL - return NULL; -#endif + + TCL_THREAD_CREATE_RETURN; } /* |