Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | CONSTified 4 functions in the Notifier which all have a Tcl_Time* in it which is supposed to be a constant, but this was not reflected in the API: Tcl_SetTimer Tcl_WaitForEvent Tcl_ConditionWait Tcl_SetMaxBlockTime Introduced a CONST86, so extensions which have their own Notifier (are there any?) can be modified to compile against both Tcl 8.5 and Tcl 8.6. This change complies with TIP #24 |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk | potential incompatibility |
| Files: | files | file ages | folders |
| SHA1: |
7ade6e690e5d9da6d707b6796e656ef6 |
| User & Date: | nijtmans 2008-07-24 21:54:38.000 |
Context
|
2008-07-24
| ||
| 21:56 | Oops, wrong date check-in: 6956cbec66 user: nijtmans tags: trunk | |
| 21:54 | CONSTified 4 functions in the Notifier which all have a Tcl_Time* in it which is supposed to be a co... check-in: 7ade6e690e user: nijtmans tags: trunk, potential incompatibility | |
|
2008-07-23
| ||
| 23:19 | Added relative speed test for pure byte array concats. check-in: 00a4e94abd user: ferrieux tags: trunk | |
Changes
Changes to ChangeLog.
1 2 3 4 5 6 7 | 2008-07-23 Alexandre Ferrieux <ferrieux@users.sourceforge.net> * tests/lrange.test: Added relative speed test to check for lrange in-place optimization committed 2008-06-30. * tests/binary.test: Added relative speed test to check for pure byte array CONCAT1 optimization committed 2008-06-30. | > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 2007-02-24 Jan Nijtmans <nijtmans@users.sf.net> * doc/Notifier.3 CONSTified 4 functions in the * doc/Thread.3 Notifier which all have a * generic/tcl.decls Tcl_Time * in it which is supposed * generic/tcl.h to be a constant, but this was not * generic/tclDecls.h reflected in the API: * generic/tclNotify.c Tcl_SetTimer * generic/tclThread.c Tcl_WaitForEvent * macosx/tclMacOSXNotify.c Tcl_ConditionWait * unix/tclUnixNotfy.c Tcl_SetMaxBlockTime * unix/tclUnixThrd.c Introduced a CONST86, so extensions which * win/tclWinNotify.c have their own Notifier (are there any?) * win/tclWinThrd.c can be modified to compile against both Tcl 8.5 and Tcl 8.6 tclDecls.h is re-generated with "make genstubs" This change complies with TIP #24 ***POTENTIAL INCOMPATIBILITY*** 2008-07-23 Alexandre Ferrieux <ferrieux@users.sourceforge.net> * tests/lrange.test: Added relative speed test to check for lrange in-place optimization committed 2008-06-30. * tests/binary.test: Added relative speed test to check for pure byte array CONCAT1 optimization committed 2008-06-30. |
| ︙ | ︙ |
Changes to doc/Notifier.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1998-1999 Scriptics Corporation '\" Copyright (c) 1995-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1998-1999 Scriptics Corporation '\" Copyright (c) 1995-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: Notifier.3,v 1.23 2008/07/24 21:54:43 nijtmans Exp $ '\" .so man.macros .TH Notifier 3 8.1 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_CreateEventSource, Tcl_DeleteEventSource, Tcl_SetMaxBlockTime, Tcl_QueueEvent, Tcl_ThreadQueueEvent, Tcl_ThreadAlert, Tcl_GetCurrentThread, Tcl_DeleteEvents, Tcl_InitNotifier, Tcl_FinalizeNotifier, Tcl_WaitForEvent, Tcl_AlertNotifier, Tcl_SetTimer, Tcl_ServiceAll, Tcl_ServiceEvent, Tcl_GetServiceMode, Tcl_SetServiceMode \- the event queue and notifier interfaces .SH SYNOPSIS |
| ︙ | ︙ | |||
79 80 81 82 83 84 85 | .AP Tcl_EventCheckProc *checkProc in Procedure for \fBTcl_DoOneEvent\fR to invoke after waiting for events. Checks to see if any events have occurred and, if so, queues them. .AP ClientData clientData in Arbitrary one-word value to pass to \fIsetupProc\fR, \fIcheckProc\fR, or \fIdeleteProc\fR. | | | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | .AP Tcl_EventCheckProc *checkProc in Procedure for \fBTcl_DoOneEvent\fR to invoke after waiting for events. Checks to see if any events have occurred and, if so, queues them. .AP ClientData clientData in Arbitrary one-word value to pass to \fIsetupProc\fR, \fIcheckProc\fR, or \fIdeleteProc\fR. .AP "const Tcl_Time" *timePtr in Indicates the maximum amount of time to wait for an event. This is specified as an interval (how long to wait), not an absolute time (when to wakeup). If the pointer passed to \fBTcl_WaitForEvent\fR is NULL, it means there is no maximum wait time: wait forever if necessary. .AP Tcl_Event *evPtr in An event to add to the event queue. The storage for the event must |
| ︙ | ︙ |
Changes to doc/Thread.3.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1999 Scriptics Corporation '\" Copyright (c) 1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1999 Scriptics Corporation '\" Copyright (c) 1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: Thread.3,v 1.30 2008/07/24 21:54:43 nijtmans Exp $ '\" .so man.macros .TH Threads 3 "8.1" Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_ConditionNotify, Tcl_ConditionWait, Tcl_ConditionFinalize, Tcl_GetThreadData, Tcl_MutexLock, Tcl_MutexUnlock, Tcl_MutexFinalize, Tcl_CreateThread, Tcl_JoinThread \- Tcl thread support .SH SYNOPSIS |
| ︙ | ︙ | |||
44 45 46 47 48 49 50 | \fBTcl_JoinThread\fR(\fIid, result\fR) .SH ARGUMENTS .AS Tcl_CreateThreadProc threadProc out .AP Tcl_Condition *condPtr in A condition variable, which must be associated with a mutex lock. .AP Tcl_Mutex *mutexPtr in A mutex lock. | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | \fBTcl_JoinThread\fR(\fIid, result\fR) .SH ARGUMENTS .AS Tcl_CreateThreadProc threadProc out .AP Tcl_Condition *condPtr in A condition variable, which must be associated with a mutex lock. .AP Tcl_Mutex *mutexPtr in A mutex lock. .AP "const Tcl_Time" *timePtr in A time limit on the condition wait. NULL to wait forever. Note that a polling value of 0 seconds does not make much sense. .AP Tcl_ThreadDataKey *keyPtr in This identifies a block of thread local storage. The key should be static and process-wide, yet each thread will end up associating a different block of storage with this key. .AP int *size in |
| ︙ | ︙ |
Changes to generic/tcl.decls.
| ︙ | ︙ | |||
8 9 10 11 12 13 14 | # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 2001, 2002 by Kevin B. Kenny. All rights reserved. # Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net> # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 2001, 2002 by Kevin B. Kenny. All rights reserved. # Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net> # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # RCS: @(#) $Id: tcl.decls,v 1.138 2008/07/24 21:54:39 nijtmans Exp $ library tcl # Define the tcl interface with several sub interfaces: # tclPlat - platform specific public # tclInt - generic private # tclPlatInt - platform specific private |
| ︙ | ︙ | |||
68 69 70 71 72 73 74 |
void Tcl_CreateFileHandler(int fd, int mask, Tcl_FileProc *proc,
ClientData clientData)
}
declare 10 unix {
void Tcl_DeleteFileHandler(int fd)
}
declare 11 generic {
| | | | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
void Tcl_CreateFileHandler(int fd, int mask, Tcl_FileProc *proc,
ClientData clientData)
}
declare 10 unix {
void Tcl_DeleteFileHandler(int fd)
}
declare 11 generic {
void Tcl_SetTimer(CONST86 Tcl_Time *timePtr)
}
declare 12 generic {
void Tcl_Sleep(int ms)
}
declare 13 generic {
int Tcl_WaitForEvent(CONST86 Tcl_Time *timePtr)
}
declare 14 generic {
int Tcl_AppendAllObjTypes(Tcl_Interp *interp, Tcl_Obj *objPtr)
}
declare 15 generic {
void Tcl_AppendStringsToObj(Tcl_Obj *objPtr, ...)
}
|
| ︙ | ︙ | |||
809 810 811 812 813 814 815 |
declare 227 generic {
void Tcl_SetErrno(int err)
}
declare 228 generic {
void Tcl_SetErrorCode(Tcl_Interp *interp, ...)
}
declare 229 generic {
| | | 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 |
declare 227 generic {
void Tcl_SetErrno(int err)
}
declare 228 generic {
void Tcl_SetErrorCode(Tcl_Interp *interp, ...)
}
declare 229 generic {
void Tcl_SetMaxBlockTime(CONST86 Tcl_Time *timePtr)
}
declare 230 generic {
void Tcl_SetPanicProc(Tcl_PanicProc *panicProc)
}
declare 231 generic {
int Tcl_SetRecursionLimit(Tcl_Interp *interp, int depth)
}
|
| ︙ | ︙ | |||
1115 1116 1117 1118 1119 1120 1121 |
void Tcl_MutexUnlock(Tcl_Mutex *mutexPtr)
}
declare 310 generic {
void Tcl_ConditionNotify(Tcl_Condition *condPtr)
}
declare 311 generic {
void Tcl_ConditionWait(Tcl_Condition *condPtr, Tcl_Mutex *mutexPtr,
| | | 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 |
void Tcl_MutexUnlock(Tcl_Mutex *mutexPtr)
}
declare 310 generic {
void Tcl_ConditionNotify(Tcl_Condition *condPtr)
}
declare 311 generic {
void Tcl_ConditionWait(Tcl_Condition *condPtr, Tcl_Mutex *mutexPtr,
CONST86 Tcl_Time *timePtr)
}
declare 312 generic {
int Tcl_NumUtfChars(CONST char *src, int length)
}
declare 313 generic {
int Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr, int charsToRead,
int appendFlag)
|
| ︙ | ︙ |
Changes to generic/tcl.h.
| ︙ | ︙ | |||
9 10 11 12 13 14 15 | * Copyright (c) 1994-1998 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Scriptics Corporation. * Copyright (c) 2002 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * Copyright (c) 1994-1998 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Scriptics Corporation. * Copyright (c) 2002 by Kevin B. Kenny. All rights reserved. * * 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.262 2008/07/24 21:54:38 nijtmans Exp $ */ #ifndef _TCL #define _TCL /* * For C++ compilers, use extern "C" |
| ︙ | ︙ | |||
141 142 143 144 145 146 147 | #include <stdio.h> /* * Support for functions with a variable number of arguments. * * The following TCL_VARARGS* macros are to support old extensions * written for older versions of Tcl where the macros permitted | | | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | #include <stdio.h> /* * Support for functions with a variable number of arguments. * * The following TCL_VARARGS* macros are to support old extensions * written for older versions of Tcl where the macros permitted * support for the varargs.h system as well as stdarg.h . * * New code should just directly be written to use stdarg.h conventions. */ #include <stdarg.h> #ifndef TCL_NO_DEPRECATED # define TCL_VARARGS(type, name) (type name, ...) |
| ︙ | ︙ | |||
163 164 165 166 167 168 169 | * windows is for a DLL, which causes the DLLIMPORT and DLLEXPORT macros to be * nonempty. To build a static library, the macro STATIC_BUILD should be * defined. * * Note: when building static but linking dynamically to MSVCRT we must still * correctly decorate the C library imported function. Use CRTIMPORT * for this purpose. _DLL is defined by the compiler when linking to | | | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | * windows is for a DLL, which causes the DLLIMPORT and DLLEXPORT macros to be * nonempty. To build a static library, the macro STATIC_BUILD should be * defined. * * Note: when building static but linking dynamically to MSVCRT we must still * correctly decorate the C library imported function. Use CRTIMPORT * for this purpose. _DLL is defined by the compiler when linking to * MSVCRT. */ #if (defined(__WIN32__) && (defined(_MSC_VER) || (__BORLANDC__ >= 0x0550) || defined(__LCC__) || defined(__WATCOMC__) || (defined(__GNUC__) && defined(__declspec)))) # define HAVE_DECLSPEC 1 # ifdef STATIC_BUILD # define DLLIMPORT # define DLLEXPORT |
| ︙ | ︙ | |||
256 257 258 259 260 261 262 263 264 265 266 267 268 269 | # define CONST84 # define CONST84_RETURN CONST # else # define CONST84 CONST # define CONST84_RETURN CONST # endif #endif /* * Make sure EXTERN isn't defined elsewhere */ #ifdef EXTERN # undef EXTERN | > > | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | # define CONST84 # define CONST84_RETURN CONST # else # define CONST84 CONST # define CONST84_RETURN CONST # endif #endif #define CONST86 CONST84 /* * Make sure EXTERN isn't defined elsewhere */ #ifdef EXTERN # undef EXTERN |
| ︙ | ︙ | |||
983 984 985 986 987 988 989 | * o Cut out of error traces * o Don't reset the flags controlling ensemble * error message rewriting. * TCL_CANCEL_UNWIND: Magical Tcl_CancelEval mode that causes the * stack for the script in progress to be * completely unwound. * TCL_EVAL_NOERR: Do no exception reporting at all, just return | | | 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 | * o Cut out of error traces * o Don't reset the flags controlling ensemble * error message rewriting. * TCL_CANCEL_UNWIND: Magical Tcl_CancelEval mode that causes the * stack for the script in progress to be * completely unwound. * TCL_EVAL_NOERR: Do no exception reporting at all, just return * as the caller will report. */ #define TCL_NO_EVAL 0x10000 #define TCL_EVAL_GLOBAL 0x20000 #define TCL_EVAL_DIRECT 0x40000 #define TCL_EVAL_INVOKE 0x80000 #define TCL_CANCEL_UNWIND 0x100000 #define TCL_EVAL_NOERR 0x200000 |
| ︙ | ︙ | |||
1337 1338 1339 1340 1341 1342 1343 |
*/
typedef struct Tcl_Time {
long sec; /* Seconds. */
long usec; /* Microseconds. */
} Tcl_Time;
| | | | 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 |
*/
typedef struct Tcl_Time {
long sec; /* Seconds. */
long usec; /* Microseconds. */
} Tcl_Time;
typedef void (Tcl_SetTimerProc) _ANSI_ARGS_((CONST86 Tcl_Time *timePtr));
typedef int (Tcl_WaitForEventProc) _ANSI_ARGS_((CONST86 Tcl_Time *timePtr));
/*
* TIP #233 (Virtualized Time)
*/
typedef void (Tcl_GetTimeProc) _ANSI_ARGS_((Tcl_Time *timebuf,
ClientData clientData));
|
| ︙ | ︙ |
Changes to generic/tclDecls.h.
1 2 3 4 5 6 7 8 9 10 | /* * tclDecls.h -- * * Declarations of functions in the platform independent public Tcl API. * * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tclDecls.h -- * * Declarations of functions in the platform independent public Tcl API. * * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclDecls.h,v 1.140 2008/07/24 21:54:39 nijtmans Exp $ */ #ifndef _TCLDECLS #define _TCLDECLS #undef TCL_STORAGE_CLASS #ifdef BUILD_tcl |
| ︙ | ︙ | |||
118 119 120 121 122 123 124 | /* 10 */ EXTERN void Tcl_DeleteFileHandler (int fd); #endif #endif /* MACOSX */ #ifndef Tcl_SetTimer_TCL_DECLARED #define Tcl_SetTimer_TCL_DECLARED /* 11 */ | | | | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | /* 10 */ EXTERN void Tcl_DeleteFileHandler (int fd); #endif #endif /* MACOSX */ #ifndef Tcl_SetTimer_TCL_DECLARED #define Tcl_SetTimer_TCL_DECLARED /* 11 */ EXTERN void Tcl_SetTimer (CONST86 Tcl_Time * timePtr); #endif #ifndef Tcl_Sleep_TCL_DECLARED #define Tcl_Sleep_TCL_DECLARED /* 12 */ EXTERN void Tcl_Sleep (int ms); #endif #ifndef Tcl_WaitForEvent_TCL_DECLARED #define Tcl_WaitForEvent_TCL_DECLARED /* 13 */ EXTERN int Tcl_WaitForEvent (CONST86 Tcl_Time * timePtr); #endif #ifndef Tcl_AppendAllObjTypes_TCL_DECLARED #define Tcl_AppendAllObjTypes_TCL_DECLARED /* 14 */ EXTERN int Tcl_AppendAllObjTypes (Tcl_Interp * interp, Tcl_Obj * objPtr); #endif |
| ︙ | ︙ | |||
1436 1437 1438 1439 1440 1441 1442 | #define Tcl_SetErrorCode_TCL_DECLARED /* 228 */ EXTERN void Tcl_SetErrorCode (Tcl_Interp * interp, ...); #endif #ifndef Tcl_SetMaxBlockTime_TCL_DECLARED #define Tcl_SetMaxBlockTime_TCL_DECLARED /* 229 */ | | | 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 | #define Tcl_SetErrorCode_TCL_DECLARED /* 228 */ EXTERN void Tcl_SetErrorCode (Tcl_Interp * interp, ...); #endif #ifndef Tcl_SetMaxBlockTime_TCL_DECLARED #define Tcl_SetMaxBlockTime_TCL_DECLARED /* 229 */ EXTERN void Tcl_SetMaxBlockTime (CONST86 Tcl_Time * timePtr); #endif #ifndef Tcl_SetPanicProc_TCL_DECLARED #define Tcl_SetPanicProc_TCL_DECLARED /* 230 */ EXTERN void Tcl_SetPanicProc (Tcl_PanicProc * panicProc); #endif #ifndef Tcl_SetRecursionLimit_TCL_DECLARED |
| ︙ | ︙ | |||
1927 1928 1929 1930 1931 1932 1933 | /* 310 */ EXTERN void Tcl_ConditionNotify (Tcl_Condition * condPtr); #endif #ifndef Tcl_ConditionWait_TCL_DECLARED #define Tcl_ConditionWait_TCL_DECLARED /* 311 */ EXTERN void Tcl_ConditionWait (Tcl_Condition * condPtr, | | > | 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 | /* 310 */ EXTERN void Tcl_ConditionNotify (Tcl_Condition * condPtr); #endif #ifndef Tcl_ConditionWait_TCL_DECLARED #define Tcl_ConditionWait_TCL_DECLARED /* 311 */ EXTERN void Tcl_ConditionWait (Tcl_Condition * condPtr, Tcl_Mutex * mutexPtr, CONST86 Tcl_Time * timePtr); #endif #ifndef Tcl_NumUtfChars_TCL_DECLARED #define Tcl_NumUtfChars_TCL_DECLARED /* 312 */ EXTERN int Tcl_NumUtfChars (CONST char * src, int length); #endif #ifndef Tcl_ReadChars_TCL_DECLARED |
| ︙ | ︙ | |||
3597 3598 3599 3600 3601 3602 3603 |
#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
void *reserved10;
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
void (*tcl_DeleteFileHandler) (int fd); /* 10 */
#endif /* MACOSX */
| | | | 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 |
#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
void *reserved10;
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
void (*tcl_DeleteFileHandler) (int fd); /* 10 */
#endif /* MACOSX */
void (*tcl_SetTimer) (CONST86 Tcl_Time * timePtr); /* 11 */
void (*tcl_Sleep) (int ms); /* 12 */
int (*tcl_WaitForEvent) (CONST86 Tcl_Time * timePtr); /* 13 */
int (*tcl_AppendAllObjTypes) (Tcl_Interp * interp, Tcl_Obj * objPtr); /* 14 */
void (*tcl_AppendStringsToObj) (Tcl_Obj * objPtr, ...); /* 15 */
void (*tcl_AppendToObj) (Tcl_Obj* objPtr, CONST char* bytes, int length); /* 16 */
Tcl_Obj * (*tcl_ConcatObj) (int objc, Tcl_Obj *CONST objv[]); /* 17 */
int (*tcl_ConvertToType) (Tcl_Interp * interp, Tcl_Obj * objPtr, Tcl_ObjType * typePtr); /* 18 */
void (*tcl_DbDecrRefCount) (Tcl_Obj * objPtr, CONST char * file, int line); /* 19 */
void (*tcl_DbIncrRefCount) (Tcl_Obj * objPtr, CONST char * file, int line); /* 20 */
|
| ︙ | ︙ | |||
3847 3848 3849 3850 3851 3852 3853 |
int (*tcl_ServiceEvent) (int flags); /* 222 */
void (*tcl_SetAssocData) (Tcl_Interp * interp, CONST char * name, Tcl_InterpDeleteProc * proc, ClientData clientData); /* 223 */
void (*tcl_SetChannelBufferSize) (Tcl_Channel chan, int sz); /* 224 */
int (*tcl_SetChannelOption) (Tcl_Interp * interp, Tcl_Channel chan, CONST char * optionName, CONST char * newValue); /* 225 */
int (*tcl_SetCommandInfo) (Tcl_Interp * interp, CONST char * cmdName, CONST Tcl_CmdInfo * infoPtr); /* 226 */
void (*tcl_SetErrno) (int err); /* 227 */
void (*tcl_SetErrorCode) (Tcl_Interp * interp, ...); /* 228 */
| | | 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 |
int (*tcl_ServiceEvent) (int flags); /* 222 */
void (*tcl_SetAssocData) (Tcl_Interp * interp, CONST char * name, Tcl_InterpDeleteProc * proc, ClientData clientData); /* 223 */
void (*tcl_SetChannelBufferSize) (Tcl_Channel chan, int sz); /* 224 */
int (*tcl_SetChannelOption) (Tcl_Interp * interp, Tcl_Channel chan, CONST char * optionName, CONST char * newValue); /* 225 */
int (*tcl_SetCommandInfo) (Tcl_Interp * interp, CONST char * cmdName, CONST Tcl_CmdInfo * infoPtr); /* 226 */
void (*tcl_SetErrno) (int err); /* 227 */
void (*tcl_SetErrorCode) (Tcl_Interp * interp, ...); /* 228 */
void (*tcl_SetMaxBlockTime) (CONST86 Tcl_Time * timePtr); /* 229 */
void (*tcl_SetPanicProc) (Tcl_PanicProc * panicProc); /* 230 */
int (*tcl_SetRecursionLimit) (Tcl_Interp * interp, int depth); /* 231 */
void (*tcl_SetResult) (Tcl_Interp * interp, char * result, Tcl_FreeProc * freeProc); /* 232 */
int (*tcl_SetServiceMode) (int mode); /* 233 */
void (*tcl_SetObjErrorCode) (Tcl_Interp * interp, Tcl_Obj * errorObjPtr); /* 234 */
void (*tcl_SetObjResult) (Tcl_Interp * interp, Tcl_Obj * resultObjPtr); /* 235 */
void (*tcl_SetStdChannel) (Tcl_Channel channel, int type); /* 236 */
|
| ︙ | ︙ | |||
3929 3930 3931 3932 3933 3934 3935 |
int (*tcl_GetIndexFromObjStruct) (Tcl_Interp * interp, Tcl_Obj * objPtr, CONST VOID * tablePtr, int offset, CONST char * msg, int flags, int * indexPtr); /* 304 */
VOID * (*tcl_GetThreadData) (Tcl_ThreadDataKey * keyPtr, int size); /* 305 */
Tcl_Obj * (*tcl_GetVar2Ex) (Tcl_Interp * interp, CONST char * part1, CONST char * part2, int flags); /* 306 */
ClientData (*tcl_InitNotifier) (void); /* 307 */
void (*tcl_MutexLock) (Tcl_Mutex * mutexPtr); /* 308 */
void (*tcl_MutexUnlock) (Tcl_Mutex * mutexPtr); /* 309 */
void (*tcl_ConditionNotify) (Tcl_Condition * condPtr); /* 310 */
| | | 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 |
int (*tcl_GetIndexFromObjStruct) (Tcl_Interp * interp, Tcl_Obj * objPtr, CONST VOID * tablePtr, int offset, CONST char * msg, int flags, int * indexPtr); /* 304 */
VOID * (*tcl_GetThreadData) (Tcl_ThreadDataKey * keyPtr, int size); /* 305 */
Tcl_Obj * (*tcl_GetVar2Ex) (Tcl_Interp * interp, CONST char * part1, CONST char * part2, int flags); /* 306 */
ClientData (*tcl_InitNotifier) (void); /* 307 */
void (*tcl_MutexLock) (Tcl_Mutex * mutexPtr); /* 308 */
void (*tcl_MutexUnlock) (Tcl_Mutex * mutexPtr); /* 309 */
void (*tcl_ConditionNotify) (Tcl_Condition * condPtr); /* 310 */
void (*tcl_ConditionWait) (Tcl_Condition * condPtr, Tcl_Mutex * mutexPtr, CONST86 Tcl_Time * timePtr); /* 311 */
int (*tcl_NumUtfChars) (CONST char * src, int length); /* 312 */
int (*tcl_ReadChars) (Tcl_Channel channel, Tcl_Obj * objPtr, int charsToRead, int appendFlag); /* 313 */
void (*tcl_RestoreResult) (Tcl_Interp * interp, Tcl_SavedResult * statePtr); /* 314 */
void (*tcl_SaveResult) (Tcl_Interp * interp, Tcl_SavedResult * statePtr); /* 315 */
int (*tcl_SetSystemEncoding) (Tcl_Interp * interp, CONST char * name); /* 316 */
Tcl_Obj * (*tcl_SetVar2Ex) (Tcl_Interp * interp, CONST char * part1, CONST char * part2, Tcl_Obj * newValuePtr, int flags); /* 317 */
void (*tcl_ThreadAlert) (Tcl_ThreadId threadId); /* 318 */
|
| ︙ | ︙ |
Changes to generic/tclNotify.c.
| ︙ | ︙ | |||
10 11 12 13 14 15 16 | * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1998 by Scriptics Corporation. * Copyright (c) 2003 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1998 by Scriptics Corporation. * Copyright (c) 2003 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclNotify.c,v 1.28 2008/07/24 21:54:38 nijtmans Exp $ */ #include "tclInt.h" /* * Module-scope struct of notifier hooks that are checked in the default * notifier functions (for overriding via Tcl_SetNotifier). |
| ︙ | ︙ | |||
790 791 792 793 794 795 796 | * May reduce the length of the next sleep in the tsdPtr-> * *---------------------------------------------------------------------- */ void Tcl_SetMaxBlockTime( | | | 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 |
* May reduce the length of the next sleep in the tsdPtr->
*
*----------------------------------------------------------------------
*/
void
Tcl_SetMaxBlockTime(
const Tcl_Time *timePtr) /* Specifies a maximum elapsed time for the
* next blocking operation in the event
* tsdPtr-> */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
if (!tsdPtr->blockTimeSet || (timePtr->sec < tsdPtr->blockTime.sec)
|| ((timePtr->sec == tsdPtr->blockTime.sec)
|
| ︙ | ︙ |
Changes to generic/tclThread.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclThread.c -- * * This file implements Platform independent thread operations. Most of * the real work is done in the platform dependent files. * * Copyright (c) 1998 by Sun Microsystems, Inc. * Copyright (c) 2008 by George Peter Staplin * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclThread.c -- * * This file implements Platform independent thread operations. Most of * the real work is done in the platform dependent files. * * Copyright (c) 1998 by Sun Microsystems, Inc. * Copyright (c) 2008 by George Peter Staplin * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclThread.c,v 1.21 2008/07/24 21:54:39 nijtmans Exp $ */ #include "tclInt.h" /* * There are three classes of synchronization objects: mutexes, thread data * keys, and condition variables. The following are used to record the memory |
| ︙ | ︙ | |||
121 122 123 124 125 126 127 |
*
*----------------------------------------------------------------------
*/
void *
TclThreadDataKeyGet(
Tcl_ThreadDataKey *keyPtr) /* Identifier for the data chunk. */
| | | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
*
*----------------------------------------------------------------------
*/
void *
TclThreadDataKeyGet(
Tcl_ThreadDataKey *keyPtr) /* Identifier for the data chunk. */
{
#ifdef TCL_THREADS
return TclThreadStorageKeyGet(keyPtr);
#else /* TCL_THREADS */
return *keyPtr;
#endif /* TCL_THREADS */
}
|
| ︙ | ︙ | |||
401 402 403 404 405 406 407 |
ckfree(blockPtr);
}
ckfree((char *) keyRecord.list);
keyRecord.list = NULL;
}
keyRecord.max = 0;
keyRecord.num = 0;
| | | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
ckfree(blockPtr);
}
ckfree((char *) keyRecord.list);
keyRecord.list = NULL;
}
keyRecord.max = 0;
keyRecord.num = 0;
#ifdef TCL_THREADS
/*
* Call thread storage master cleanup.
*/
TclFinalizeThreadStorage();
|
| ︙ | ︙ | |||
492 493 494 495 496 497 498 |
*/
#undef Tcl_ConditionWait
void
Tcl_ConditionWait(
Tcl_Condition *condPtr, /* Really (pthread_cond_t **) */
Tcl_Mutex *mutexPtr, /* Really (pthread_mutex_t **) */
| | | 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 |
*/
#undef Tcl_ConditionWait
void
Tcl_ConditionWait(
Tcl_Condition *condPtr, /* Really (pthread_cond_t **) */
Tcl_Mutex *mutexPtr, /* Really (pthread_mutex_t **) */
const Tcl_Time *timePtr) /* Timeout on waiting period */
{
}
#undef Tcl_ConditionNotify
void
Tcl_ConditionNotify(
Tcl_Condition *condPtr)
|
| ︙ | ︙ |
Changes to macosx/tclMacOSXNotify.c.
| ︙ | ︙ | |||
8 9 10 11 12 13 14 | * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright 2001, Apple Computer, Inc. * Copyright (c) 2005-2008 Daniel A. Steffen <das@users.sourceforge.net> * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright 2001, Apple Computer, Inc. * Copyright (c) 2005-2008 Daniel A. Steffen <das@users.sourceforge.net> * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclMacOSXNotify.c,v 1.20 2008/07/24 21:54:43 nijtmans Exp $ */ #include "tclInt.h" #ifdef HAVE_COREFOUNDATION /* Traditional unix select-based notifier is * in tclUnixNotfy.c */ #include <CoreFoundation/CoreFoundation.h> #include <pthread.h> |
| ︙ | ︙ | |||
601 602 603 604 605 606 607 | * None. * *---------------------------------------------------------------------- */ void Tcl_SetTimer( | | | 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 |
* None.
*
*----------------------------------------------------------------------
*/
void
Tcl_SetTimer(
const Tcl_Time *timePtr) /* Timeout value, may be NULL. */
{
if (tclNotifierHooks.setTimerProc) {
tclNotifierHooks.setTimerProc(timePtr);
return;
} else {
/*
* The interval timer doesn't do anything in this implementation,
|
| ︙ | ︙ | |||
899 900 901 902 903 904 905 | * Queues file events that are detected by the select. * *---------------------------------------------------------------------- */ int Tcl_WaitForEvent( | | | 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 |
* Queues file events that are detected by the select.
*
*----------------------------------------------------------------------
*/
int
Tcl_WaitForEvent(
const Tcl_Time *timePtr) /* Maximum block time, or NULL. */
{
if (tclNotifierHooks.waitForEventProc) {
return tclNotifierHooks.waitForEventProc(timePtr);
} else {
FileHandler *filePtr;
FileHandlerEvent *fileEvPtr;
int mask;
|
| ︙ | ︙ |
Changes to unix/tclUnixNotfy.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclUnixNotify.c -- * * This file contains the implementation of the select()-based * Unix-specific notifier, which is the lowest-level part of the Tcl * event loop. This file works together with generic/tclNotify.c. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclUnixNotify.c -- * * This file contains the implementation of the select()-based * Unix-specific notifier, which is the lowest-level part of the Tcl * event loop. This file works together with generic/tclNotify.c. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclUnixNotfy.c,v 1.36 2008/07/24 21:54:42 nijtmans Exp $ */ #include "tclInt.h" #ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier is * in tclMacOSXNotify.c */ #include <signal.h> |
| ︙ | ︙ | |||
367 368 369 370 371 372 373 | * None. * *---------------------------------------------------------------------- */ void Tcl_SetTimer( | | | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
* None.
*
*----------------------------------------------------------------------
*/
void
Tcl_SetTimer(
const Tcl_Time *timePtr) /* Timeout value, may be NULL. */
{
if (tclNotifierHooks.setTimerProc) {
tclNotifierHooks.setTimerProc(timePtr);
return;
} else {
/*
* The interval timer doesn't do anything in this implementation,
|
| ︙ | ︙ | |||
665 666 667 668 669 670 671 | * Queues file events that are detected by the select. * *---------------------------------------------------------------------- */ int Tcl_WaitForEvent( | | | 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 |
* Queues file events that are detected by the select.
*
*----------------------------------------------------------------------
*/
int
Tcl_WaitForEvent(
const Tcl_Time *timePtr) /* Maximum block time, or NULL. */
{
if (tclNotifierHooks.waitForEventProc) {
return tclNotifierHooks.waitForEventProc(timePtr);
} else {
FileHandler *filePtr;
FileHandlerEvent *fileEvPtr;
int mask;
|
| ︙ | ︙ |
Changes to unix/tclUnixThrd.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclUnixThrd.c -- * * This file implements the UNIX-specific thread support. * * Copyright (c) 1991-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 2008 by George Peter Staplin * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclUnixThrd.c -- * * This file implements the UNIX-specific thread support. * * Copyright (c) 1991-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 2008 by George Peter Staplin * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclUnixThrd.c,v 1.59 2008/07/24 21:54:42 nijtmans Exp $ */ #include "tclInt.h" #ifdef TCL_THREADS #include "pthread.h" |
| ︙ | ︙ | |||
220 221 222 223 224 225 226 |
size_t
TclpThreadGetStackSize(void)
{
size_t stackSize = 0;
#if defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE) && defined(TclpPthreadGetAttrs)
pthread_attr_t threadAttr; /* This will hold the thread attributes for
* the current thread. */
| | | | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
size_t
TclpThreadGetStackSize(void)
{
size_t stackSize = 0;
#if defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE) && defined(TclpPthreadGetAttrs)
pthread_attr_t threadAttr; /* This will hold the thread attributes for
* the current thread. */
#ifdef __GLIBC__
/*
* Fix for [Bug 1815573]
*
* DESCRIPTION:
* On linux TclpPthreadGetAttrs (which is pthread_attr_get_np) may return
* bogus values on the initial thread.
*
* ASSUMPTIONS:
* There seems to be no api to determine if we are on the initial
* thread. The simple scheme implemented here assumes:
* 1. The first Tcl interp to be created lives in the initial thread. If
* this assumption is not true, the fix is to call
* TclpThreadGetStackSize from the initial thread previous to
|
| ︙ | ︙ | |||
264 265 266 267 268 269 270 |
}
if (TclpPthreadGetAttrs(pthread_self(), &threadAttr) != 0) {
pthread_attr_destroy(&threadAttr);
return (size_t)-1;
}
}
| | | | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
}
if (TclpPthreadGetAttrs(pthread_self(), &threadAttr) != 0) {
pthread_attr_destroy(&threadAttr);
return (size_t)-1;
}
}
if (pthread_attr_getstacksize(&threadAttr, &stackSize) != 0) {
pthread_attr_destroy(&threadAttr);
return (size_t)-1;
}
pthread_attr_destroy(&threadAttr);
#elif defined(HAVE_PTHREAD_GET_STACKSIZE_NP)
#ifdef __APPLE__
/*
* On Darwin, the API below does not return the correct stack size for the
* main thread (which is not a real pthread), so fallback to getrlimit().
*/
if (!pthread_main_np())
#endif
stackSize = pthread_get_stacksize_np(pthread_self());
#else
/*
* Cannot determine the real stack size of this thread. The caller might
* want to try looking at the process accounting limits instead.
|
| ︙ | ︙ | |||
613 614 615 616 617 618 619 |
*----------------------------------------------------------------------
*/
void
Tcl_ConditionWait(
Tcl_Condition *condPtr, /* Really (pthread_cond_t **) */
Tcl_Mutex *mutexPtr, /* Really (pthread_mutex_t **) */
| | | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 |
*----------------------------------------------------------------------
*/
void
Tcl_ConditionWait(
Tcl_Condition *condPtr, /* Really (pthread_cond_t **) */
Tcl_Mutex *mutexPtr, /* Really (pthread_mutex_t **) */
const Tcl_Time *timePtr) /* Timeout on waiting period */
{
pthread_cond_t *pcondPtr;
pthread_mutex_t *pmutexPtr;
struct timespec ptime;
if (*condPtr == NULL) {
MASTER_LOCK;
|
| ︙ | ︙ | |||
878 879 880 881 882 883 884 |
}
TclpSysFree(keyPtr);
}
void TclpThreadSetMasterTSD(void *tsdKeyPtr, void *ptr) {
pthread_key_t *key = tsdKeyPtr;
| | | 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 |
}
TclpSysFree(keyPtr);
}
void TclpThreadSetMasterTSD(void *tsdKeyPtr, void *ptr) {
pthread_key_t *key = tsdKeyPtr;
if (pthread_setspecific(*key, ptr)) {
Tcl_Panic("unable to set master TSD value");
}
}
void *TclpThreadGetMasterTSD(void *tsdKeyPtr) {
pthread_key_t *key = tsdKeyPtr;
|
| ︙ | ︙ |
Changes to win/tclWinNotify.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclWinNotify.c -- * * This file contains Windows-specific procedures for the notifier, which * is the lowest-level part of the Tcl event loop. This file works * together with ../generic/tclNotify.c. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclWinNotify.c -- * * This file contains Windows-specific procedures for the notifier, which * is the lowest-level part of the Tcl event loop. This file works * together with ../generic/tclNotify.c. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclWinNotify.c,v 1.24 2008/07/24 21:54:43 nijtmans Exp $ */ #include "tclInt.h" /* * The follwing static indicates whether this module has been initialized. */ |
| ︙ | ︙ | |||
264 265 266 267 268 269 270 | * Replaces any previous timer. * *---------------------------------------------------------------------- */ void Tcl_SetTimer( | | | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
* Replaces any previous timer.
*
*----------------------------------------------------------------------
*/
void
Tcl_SetTimer(
const Tcl_Time *timePtr) /* Maximum block time, or NULL. */
{
if (tclNotifierHooks.setTimerProc) {
tclNotifierHooks.setTimerProc(timePtr);
return;
} else {
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
UINT timeout;
|
| ︙ | ︙ | |||
427 428 429 430 431 432 433 | * Dispatches a message to a window procedure, which could do anything. * *---------------------------------------------------------------------- */ int Tcl_WaitForEvent( | | | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
* Dispatches a message to a window procedure, which could do anything.
*
*----------------------------------------------------------------------
*/
int
Tcl_WaitForEvent(
const Tcl_Time *timePtr) /* Maximum block time, or NULL. */
{
if (tclNotifierHooks.waitForEventProc) {
return tclNotifierHooks.waitForEventProc(timePtr);
} else {
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
MSG msg;
DWORD timeout, result;
|
| ︙ | ︙ |
Changes to win/tclWinThrd.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclWinThread.c -- * * This file implements the Windows-specific thread operations. * * Copyright (c) 1998 by Sun Microsystems, Inc. * Copyright (c) 1999 by Scriptics Corporation * Copyright (c) 2008 by George Peter Staplin * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclWinThread.c -- * * This file implements the Windows-specific thread operations. * * Copyright (c) 1998 by Sun Microsystems, Inc. * Copyright (c) 1999 by Scriptics Corporation * Copyright (c) 2008 by George Peter Staplin * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclWinThrd.c,v 1.48 2008/07/24 21:54:43 nijtmans Exp $ */ #include "tclWinInt.h" #include <fcntl.h> #include <io.h> #include <sys/stat.h> |
| ︙ | ︙ | |||
586 587 588 589 590 591 592 |
*----------------------------------------------------------------------
*/
void
Tcl_ConditionWait(
Tcl_Condition *condPtr, /* Really (WinCondition **) */
Tcl_Mutex *mutexPtr, /* Really (CRITICAL_SECTION **) */
| | | 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 |
*----------------------------------------------------------------------
*/
void
Tcl_ConditionWait(
Tcl_Condition *condPtr, /* Really (WinCondition **) */
Tcl_Mutex *mutexPtr, /* Really (CRITICAL_SECTION **) */
const Tcl_Time *timePtr) /* Timeout on waiting period */
{
WinCondition *winCondPtr; /* Per-condition queue head */
CRITICAL_SECTION *csPtr; /* Caller's Mutex, after casting */
DWORD wtime; /* Windows time value */
int timeout; /* True if we got a timeout */
int doExit = 0; /* True if we need to do exit setup */
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
|
| ︙ | ︙ | |||
963 964 965 966 967 968 969 |
void *TclpThreadCreateKey (void) {
DWORD *key;
key = TclpSysAlloc(sizeof *key, 0);
if (key == NULL) {
Tcl_Panic("unable to allocate thread key!");
}
| | | | | 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 |
void *TclpThreadCreateKey (void) {
DWORD *key;
key = TclpSysAlloc(sizeof *key, 0);
if (key == NULL) {
Tcl_Panic("unable to allocate thread key!");
}
*key = TlsAlloc();
if (*key == TLS_OUT_OF_INDEXES) {
Tcl_Panic("unable to allocate thread-local storage");
}
return key;
}
void TclpThreadDeleteKey(void *keyPtr) {
DWORD *key = keyPtr;
if (!TlsFree(*key)) {
Tcl_Panic("unable to delete key");
}
TclpSysFree(keyPtr);
}
void TclpThreadSetMasterTSD(void *tsdKeyPtr, void *ptr) {
DWORD *key = tsdKeyPtr;
if (!TlsSetValue(*key, ptr)) {
Tcl_Panic("unable to set master TSD value");
}
}
void *TclpThreadGetMasterTSD(void *tsdKeyPtr) {
DWORD *key = tsdKeyPtr;
|
| ︙ | ︙ |