diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-07-05 10:22:57 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-07-05 10:22:57 (GMT) |
| commit | 9e72f541504261b64c3fd6bf696293fe4b6f7e8e (patch) | |
| tree | 893a03fa427c583afedcb5c5b8a0b0babe7fb935 | |
| parent | b78fe450ce4850f5bc991818448e1026f6edc08e (diff) | |
| parent | 73390782ea84a72d621c6ebbaf2b18ae9308b93b (diff) | |
| download | tcl-9e72f541504261b64c3fd6bf696293fe4b6f7e8e.zip tcl-9e72f541504261b64c3fd6bf696293fe4b6f7e8e.tar.gz tcl-9e72f541504261b64c3fd6bf696293fe4b6f7e8e.tar.bz2 | |
Merge 8.7
| -rw-r--r-- | doc/Notifier.3 | 2 | ||||
| -rw-r--r-- | generic/tcl.decls | 4 | ||||
| -rw-r--r-- | generic/tclDecls.h | 8 | ||||
| -rw-r--r-- | generic/tclNotify.c | 38 |
4 files changed, 24 insertions, 28 deletions
diff --git a/doc/Notifier.3 b/doc/Notifier.3 index 5662192..e01abc4 100644 --- a/doc/Notifier.3 +++ b/doc/Notifier.3 @@ -90,7 +90,7 @@ necessary. .AP Tcl_Event *evPtr in An event to add to the event queue. The storage for the event must have been allocated by the caller using \fBTcl_Alloc\fR. -.AP int flags in +.AP int position in Where to add the new event in the queue: \fBTCL_QUEUE_TAIL\fR, \fBTCL_QUEUE_HEAD\fR, \fBTCL_QUEUE_MARK\fR, and whether to do an alert if the queue is empty: \fBTCL_QUEUE_ALERT_IF_EMPTY\fR. diff --git a/generic/tcl.decls b/generic/tcl.decls index 0c770c0..cef85ec 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -756,7 +756,7 @@ declare 204 { const char *Tcl_PosixError(Tcl_Interp *interp) } declare 205 { - void Tcl_QueueEvent(Tcl_Event *evPtr, int flags) + void Tcl_QueueEvent(Tcl_Event *evPtr, int position) } declare 206 { size_t Tcl_Read(Tcl_Channel chan, char *bufPtr, size_t toRead) @@ -1189,7 +1189,7 @@ declare 318 { } declare 319 { void Tcl_ThreadQueueEvent(Tcl_ThreadId threadId, Tcl_Event *evPtr, - int flags) + int position) } declare 320 { int Tcl_UniCharAtIndex(const char *src, size_t index) diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 62e3e6c..a4d77cc 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -571,7 +571,7 @@ EXTERN int Tcl_PutEnv(const char *assignment); /* 204 */ EXTERN const char * Tcl_PosixError(Tcl_Interp *interp); /* 205 */ -EXTERN void Tcl_QueueEvent(Tcl_Event *evPtr, int flags); +EXTERN void Tcl_QueueEvent(Tcl_Event *evPtr, int position); /* 206 */ EXTERN size_t Tcl_Read(Tcl_Channel chan, char *bufPtr, size_t toRead); @@ -847,7 +847,7 @@ EXTERN Tcl_Obj * Tcl_SetVar2Ex(Tcl_Interp *interp, const char *part1, EXTERN void Tcl_ThreadAlert(Tcl_ThreadId threadId); /* 319 */ EXTERN void Tcl_ThreadQueueEvent(Tcl_ThreadId threadId, - Tcl_Event *evPtr, int flags); + Tcl_Event *evPtr, int position); /* 320 */ EXTERN int Tcl_UniCharAtIndex(const char *src, size_t index); /* 321 */ @@ -2023,7 +2023,7 @@ typedef struct TclStubs { void (*tcl_PrintDouble) (Tcl_Interp *interp, double value, char *dst); /* 202 */ int (*tcl_PutEnv) (const char *assignment); /* 203 */ const char * (*tcl_PosixError) (Tcl_Interp *interp); /* 204 */ - void (*tcl_QueueEvent) (Tcl_Event *evPtr, int flags); /* 205 */ + void (*tcl_QueueEvent) (Tcl_Event *evPtr, int position); /* 205 */ size_t (*tcl_Read) (Tcl_Channel chan, char *bufPtr, size_t toRead); /* 206 */ void (*tcl_ReapDetachedProcs) (void); /* 207 */ int (*tcl_RecordAndEval) (Tcl_Interp *interp, const char *cmd, int flags); /* 208 */ @@ -2137,7 +2137,7 @@ typedef struct TclStubs { 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 */ - void (*tcl_ThreadQueueEvent) (Tcl_ThreadId threadId, Tcl_Event *evPtr, int flags); /* 319 */ + void (*tcl_ThreadQueueEvent) (Tcl_ThreadId threadId, Tcl_Event *evPtr, int position); /* 319 */ int (*tcl_UniCharAtIndex) (const char *src, size_t index); /* 320 */ int (*tcl_UniCharToLower) (int ch); /* 321 */ int (*tcl_UniCharToTitle) (int ch); /* 322 */ diff --git a/generic/tclNotify.c b/generic/tclNotify.c index c6ac34e..fc035f2 100644 --- a/generic/tclNotify.c +++ b/generic/tclNotify.c @@ -96,7 +96,7 @@ TCL_DECLARE_MUTEX(listLock) */ static int QueueEvent(ThreadSpecificData *tsdPtr, - Tcl_Event *evPtr, int flags); + Tcl_Event *evPtr, int position); /* *---------------------------------------------------------------------- @@ -175,8 +175,7 @@ TclFinalizeNotifier(void) Tcl_Event *evPtr, *hold; if (!tsdPtr->initialized) { - return; /* Notifier not initialized for the current - * thread. */ + return; /* Notifier not initialized for the current thread */ } Tcl_MutexLock(&(tsdPtr->queueMutex)); @@ -310,7 +309,7 @@ Tcl_CreateEventSource( * checkProc. */ { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - EventSource *sourcePtr = (EventSource *) Tcl_Alloc(sizeof(EventSource)); + EventSource *sourcePtr = (EventSource *)Tcl_Alloc(sizeof(EventSource)); sourcePtr->setupProc = setupProc; sourcePtr->checkProc = checkProc; @@ -392,12 +391,12 @@ Tcl_QueueEvent( * malloc (Tcl_Alloc), and it becomes the * property of the event queue. It will be * freed after the event has been handled. */ - int flags) /* One of TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, - * TCL_QUEUE_MARK, possibly combined with TCL_QUEUE_ALERT_IF_EMPTY. */ + int position) /* One of TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK, + * possibly combined with TCL_QUEUE_ALERT_IF_EMPTY. */ { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void) QueueEvent(tsdPtr, evPtr, flags); + QueueEvent(tsdPtr, evPtr, position); } /* @@ -424,8 +423,8 @@ Tcl_ThreadQueueEvent( * malloc (Tcl_Alloc), and it becomes the * property of the event queue. It will be * freed after the event has been handled. */ - int flags) /* One of TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, - * TCL_QUEUE_MARK, possibly combined with TCL_QUEUE_ALERT_IF_EMPTY. */ + int position) /* One of TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK, + * possibly combined with TCL_QUEUE_ALERT_IF_EMPTY. */ { ThreadSpecificData *tsdPtr; @@ -444,7 +443,7 @@ Tcl_ThreadQueueEvent( */ if (tsdPtr) { - if (QueueEvent(tsdPtr, evPtr, flags)) { + if (QueueEvent(tsdPtr, evPtr, position)) { Tcl_AlertNotifier(tsdPtr->clientData); } } else { @@ -484,15 +483,14 @@ QueueEvent( * malloc (Tcl_Alloc), and it becomes the * property of the event queue. It will be * freed after the event has been handled. */ - int flags) - /* One of TCL_QUEUE_TAIL_EX, - * TCL_QUEUE_HEAD_EX, TCL_QUEUE_MARK_EX, + int position) /* One of TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK, * possibly combined with TCL_QUEUE_ALERT_IF_EMPTY */ { - int wasEmpty = 0; - Tcl_MutexLock(&(tsdPtr->queueMutex)); - if ((flags & 3) == TCL_QUEUE_TAIL) { + if (tsdPtr->firstEventPtr != NULL) { + position &= ~TCL_QUEUE_ALERT_IF_EMPTY; + } + if ((position & 3) == TCL_QUEUE_TAIL) { /* * Append the event on the end of the queue. */ @@ -500,12 +498,11 @@ QueueEvent( evPtr->nextPtr = NULL; if (tsdPtr->firstEventPtr == NULL) { tsdPtr->firstEventPtr = evPtr; - wasEmpty = (flags & TCL_QUEUE_ALERT_IF_EMPTY) ? 1 : 0; } else { tsdPtr->lastEventPtr->nextPtr = evPtr; } tsdPtr->lastEventPtr = evPtr; - } else if ((flags & 3) == TCL_QUEUE_HEAD) { + } else if ((position & 3) == TCL_QUEUE_HEAD) { /* * Push the event on the head of the queue. */ @@ -513,10 +510,9 @@ QueueEvent( evPtr->nextPtr = tsdPtr->firstEventPtr; if (tsdPtr->firstEventPtr == NULL) { tsdPtr->lastEventPtr = evPtr; - wasEmpty = (flags & TCL_QUEUE_ALERT_IF_EMPTY) ? 1 : 0; } tsdPtr->firstEventPtr = evPtr; - } else if ((flags & 3) == TCL_QUEUE_MARK) { + } else if ((position & 3) == TCL_QUEUE_MARK) { /* * Insert the event after the current marker event and advance the * marker to the new event. @@ -535,7 +531,7 @@ QueueEvent( } } Tcl_MutexUnlock(&(tsdPtr->queueMutex)); - return wasEmpty; + return position & TCL_QUEUE_ALERT_IF_EMPTY; } /* |
