diff options
Diffstat (limited to 'doc/Async.3')
-rw-r--r-- | doc/Async.3 | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/doc/Async.3 b/doc/Async.3 index cc3354b..c4439a4 100644 --- a/doc/Async.3 +++ b/doc/Async.3 @@ -48,9 +48,9 @@ or 0 if \fIinterp\fR is NULL. These procedures provide a safe mechanism for dealing with asynchronous events such as signals. If an event such as a signal occurs while a Tcl script is being -evaluated then it isn't safe to take any substantive action to +evaluated then it is not safe to take any substantive action to process the event. -For example, it isn't safe to evaluate a Tcl script since the +For example, it is not safe to evaluate a Tcl script since the interpreter may already be in the middle of evaluating a script; it may not even be safe to allocate memory, since a memory allocation could have been in progress when the event occurred. @@ -140,7 +140,6 @@ If new handlers become ready while handlers are executing, \fBTcl_AsyncInvoke\fR will invoke them all; at each point it invokes the highest-priority (oldest) ready handler, repeating this over and over until there are no longer any ready handlers. - .SH WARNING .PP It is almost always a bad idea for an asynchronous event @@ -150,12 +149,11 @@ This sort of behavior can disrupt the execution of scripts in subtle ways and result in bugs that are extremely difficult to track down. If an asynchronous event handler needs to evaluate Tcl scripts -then it should first save the interpreter's result plus the values -of the variables \fBerrorInfo\fR and \fBerrorCode\fR (this can -be done, for example, by storing them in dynamic strings). +then it should first save the interpreter's state by calling +\fBTcl_SaveInterpState\fR, passing in the \fIcode\fR argument. When the asynchronous handler is finished it should restore -the interpreter's result, \fBerrorInfo\fR, and \fBerrorCode\fR, -and return the \fIcode\fR argument. +the interpreter's state by calling \fBTcl_RestoreInterpState\fR, +and then returning the \fIcode\fR argument. .SH KEYWORDS -asynchronous event, handler, signal +asynchronous event, handler, signal, Tcl_SaveInterpState, thread |