| 1 |
'\" |
| 2 |
'\" Copyright (c) 2006-2008 Joe Mistachkin. |
| 3 |
'\" |
| 4 |
'\" See the file "license.terms" for information on usage and redistribution |
| 5 |
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 6 |
'\" |
| 7 |
.TH Tcl_Cancel 3 8.6 Tcl "Tcl Library Procedures" |
| 8 |
.so man.macros |
| 9 |
.BS |
| 10 |
.SH NAME |
| 11 |
Tcl_CancelEval, Tcl_Canceled \- cancel Tcl scripts |
| 12 |
.SH SYNOPSIS |
| 13 |
.nf |
| 14 |
\fB#include <tcl.h>\fR |
| 15 |
int |
| 16 |
\fBTcl_CancelEval\fR(\fIinterp, resultObjPtr, clientData, flags\fR) |
| 17 |
.sp |
| 18 |
int |
| 19 |
\fBTcl_Canceled\fR(\fIinterp, flags\fR) |
| 20 |
.SH ARGUMENTS |
| 21 |
.AS Tcl_Interp *interp |
| 22 |
.AP Tcl_Interp *interp in |
| 23 |
Interpreter in which to cancel the script. |
| 24 |
.AP Tcl_Obj *resultObjPtr in |
| 25 |
Error message to use in the cancellation, or NULL to use a default message. If |
| 26 |
not NULL, this object will have its reference count decremented before |
| 27 |
\fBTcl_CancelEval\fR returns. |
| 28 |
.AP int flags in |
| 29 |
OR'ed combination of flag bits that specify additional options. |
| 30 |
For \fBTcl_CancelEval\fR, only \fBTCL_CANCEL_UNWIND\fR is currently |
| 31 |
supported. For \fBTcl_Canceled\fR, only \fBTCL_LEAVE_ERR_MSG\fR and |
| 32 |
\fBTCL_CANCEL_UNWIND\fR are currently supported. |
| 33 |
.AP ClientData clientData in |
| 34 |
Currently reserved for future use. |
| 35 |
It should be set to NULL. |
| 36 |
.BE |
| 37 |
.SH DESCRIPTION |
| 38 |
.PP |
| 39 |
\fBTcl_CancelEval\fR cancels or unwinds the script in progress soon after |
| 40 |
the next invocation of asynchronous handlers, causing \fBTCL_ERROR\fR to be |
| 41 |
the return code for that script. This function is thread-safe and may be |
| 42 |
called from any thread in the process. |
| 43 |
.PP |
| 44 |
\fBTcl_Canceled\fR checks if the script in progress has been canceled and |
| 45 |
returns \fBTCL_ERROR\fR if it has. Otherwise, \fBTCL_OK\fR is returned. |
| 46 |
Extensions can use this function to check to see if they should abort a long |
| 47 |
running command. This function is thread sensitive and may only be called |
| 48 |
from the thread the interpreter was created in. |
| 49 |
.SS "FLAG BITS" |
| 50 |
Any OR'ed combination of the following values may be used for the |
| 51 |
\fIflags\fR argument to procedures such as \fBTcl_CancelEval\fR: |
| 52 |
.TP 20 |
| 53 |
\fBTCL_CANCEL_UNWIND\fR |
| 54 |
. |
| 55 |
This flag is used by \fBTcl_CancelEval\fR and \fBTcl_Canceled\fR. |
| 56 |
For \fBTcl_CancelEval\fR, if this flag is set, the script in progress |
| 57 |
is canceled and the evaluation stack for the interpreter is unwound. |
| 58 |
For \fBTcl_Canceled\fR, if this flag is set, the script in progress |
| 59 |
is considered to be canceled only if the evaluation stack for the |
| 60 |
interpreter is being unwound. |
| 61 |
.TP 20 |
| 62 |
\fBTCL_LEAVE_ERR_MSG\fR |
| 63 |
. |
| 64 |
This flag is only used by \fBTcl_Canceled\fR; it is ignored by |
| 65 |
other procedures. If an error is returned and this bit is set in |
| 66 |
\fIflags\fR, then an error message will be left in the interpreter's |
| 67 |
result, where it can be retrieved with \fBTcl_GetObjResult\fR or |
| 68 |
\fBTcl_GetStringResult\fR. If this flag bit is not set then no error |
| 69 |
message is left and the interpreter's result will not be modified. |
| 70 |
.SH "SEE ALSO" |
| 71 |
interp(n), Tcl_Eval(3), |
| 72 |
TIP 285 |
| 73 |
.SH KEYWORDS |
| 74 |
cancel, unwind |