Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch bug-3407860fff Excluding Merge-Ins
This is equivalent to a diff from 673db50dc4 to 679580a1b4
2016-05-31
| ||
10:53 | [3407860fff] Accept a status argument in [thread::exit] check-in: 0839286864 user: gahr tags: trunk | |
2016-05-19
| ||
14:03 | [3407860fff] Accept a status argument in [thread::exit] Closed-Leaf check-in: 679580a1b4 user: gahr tags: bug-3407860fff | |
2016-05-18
| ||
18:54 | Fix indentation check-in: 673db50dc4 user: gahr tags: trunk | |
18:53 | [84be1b5a73] Add test case, update ChangeLog check-in: 95bfc24136 user: gahr tags: trunk | |
Changes to doc/html/thread.html.
︙ | ︙ | |||
122 123 124 125 126 127 128 | <li><a href="#1"><b class="cmd">thread::create</b> <span class="opt">?-joinable?</span> <span class="opt">?-preserved?</span> <span class="opt">?script?</span></a></li> <li><a href="#2"><b class="cmd">thread::preserve</b> <span class="opt">?id?</span></a></li> <li><a href="#3"><b class="cmd">thread::release</b> <span class="opt">?-wait?</span> <span class="opt">?id?</span></a></li> <li><a href="#4"><b class="cmd">thread::id</b></a></li> <li><a href="#5"><b class="cmd">thread::errorproc</b> <span class="opt">?procname?</span></a></li> <li><a href="#6"><b class="cmd">thread::cancel</b> <span class="opt">?-unwind?</span> <i class="arg">id</i> <span class="opt">?result?</span></a></li> <li><a href="#7"><b class="cmd">thread::unwind</b></a></li> | | | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | <li><a href="#1"><b class="cmd">thread::create</b> <span class="opt">?-joinable?</span> <span class="opt">?-preserved?</span> <span class="opt">?script?</span></a></li> <li><a href="#2"><b class="cmd">thread::preserve</b> <span class="opt">?id?</span></a></li> <li><a href="#3"><b class="cmd">thread::release</b> <span class="opt">?-wait?</span> <span class="opt">?id?</span></a></li> <li><a href="#4"><b class="cmd">thread::id</b></a></li> <li><a href="#5"><b class="cmd">thread::errorproc</b> <span class="opt">?procname?</span></a></li> <li><a href="#6"><b class="cmd">thread::cancel</b> <span class="opt">?-unwind?</span> <i class="arg">id</i> <span class="opt">?result?</span></a></li> <li><a href="#7"><b class="cmd">thread::unwind</b></a></li> <li><a href="#8"><b class="cmd">thread::exit</b> <span class="opt">?status?</span></a></li> <li><a href="#9"><b class="cmd">thread::names</b></a></li> <li><a href="#10"><b class="cmd">thread::exists</b> <i class="arg">id</i></a></li> <li><a href="#11"><b class="cmd">thread::send</b> <span class="opt">?-async?</span> <span class="opt">?-head?</span> <i class="arg">id</i> <i class="arg">script</i> <span class="opt">?varname?</span></a></li> <li><a href="#12"><b class="cmd">thread::broadcast</b> <i class="arg">script</i></a></li> <li><a href="#13"><b class="cmd">thread::wait</b></a></li> <li><a href="#14"><b class="cmd">thread::eval</b> <span class="opt">?-lock mutex?</span> <i class="arg">arg</i> <span class="opt">?arg ...?</span></a></li> <li><a href="#15"><b class="cmd">thread::join</b> <i class="arg">id</i></a></li> |
︙ | ︙ | |||
298 299 300 301 302 303 304 | command will dissapear in some future major release of the extension.</p> <p>This command stops a prior <b class="cmd">thread::wait</b> command. Execution of the script passed to newly created thread will continue from the <b class="cmd">thread::wait</b> command. If <b class="cmd">thread::wait</b> was the last command in the script, the thread will exit. The command returns empty result but may trigger Tcl error with the message "target thread died" in some situations.</p></dd> | | | | > | | | | | | 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | command will dissapear in some future major release of the extension.</p> <p>This command stops a prior <b class="cmd">thread::wait</b> command. Execution of the script passed to newly created thread will continue from the <b class="cmd">thread::wait</b> command. If <b class="cmd">thread::wait</b> was the last command in the script, the thread will exit. The command returns empty result but may trigger Tcl error with the message "target thread died" in some situations.</p></dd> <dt><a name="8"><b class="cmd">thread::exit</b> <span class="opt">?status?</span></a></dt> <dd><p>Use of this command is deprecated in favour of more advanced thread reservation system implemented with <b class="cmd">thread::preserve</b> and <b class="cmd">thread::release</b> commands. Support for <b class="cmd">thread::exit</b> command will dissapear in some future major release of the extension.</p> <p>This command forces a thread stuck in the <b class="cmd">thread::wait</b> command to unconditionaly exit. The thread's exit status defaults to 666 and can be specified using the optional <i class="arg">status</i> argument. The execution of <b class="cmd">thread::exit</b> command is guaranteed to leave the program memory in the unconsistent state, produce memory leaks and otherwise affect other subsytem(s) of the Tcl application in an unpredictable manner. The command returns empty result but may trigger Tcl error with the message "target thread died" in some situations.</p></dd> <dt><a name="9"><b class="cmd">thread::names</b></a></dt> <dd><p>This command returns a list of thread IDs. These are only for threads that have been created via <b class="cmd">thread::create</b> command. If your application creates other threads at the C level, they are not reported by this command.</p></dd> <dt><a name="10"><b class="cmd">thread::exists</b> <i class="arg">id</i></a></dt> <dd><p>Returns true (1) if thread given by the <i class="arg">id</i> parameter exists, |
︙ | ︙ |
Changes to doc/man/thread.n.
︙ | ︙ | |||
287 288 289 290 291 292 293 | .sp \fBthread::errorproc\fR ?procname? .sp \fBthread::cancel\fR ?-unwind? \fIid\fR ?result? .sp \fBthread::unwind\fR .sp | | | 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | .sp \fBthread::errorproc\fR ?procname? .sp \fBthread::cancel\fR ?-unwind? \fIid\fR ?result? .sp \fBthread::unwind\fR .sp \fBthread::exit\fR ?status? .sp \fBthread::names\fR .sp \fBthread::exists\fR \fIid\fR .sp \fBthread::send\fR ?-async? ?-head? \fIid\fR \fIscript\fR ?varname? .sp |
︙ | ︙ | |||
510 511 512 513 514 515 516 | This command stops a prior \fBthread::wait\fR command\&. Execution of the script passed to newly created thread will continue from the \fBthread::wait\fR command\&. If \fBthread::wait\fR was the last command in the script, the thread will exit\&. The command returns empty result but may trigger Tcl error with the message "target thread died" in some situations\&. .TP | | | | > | | | | | | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | This command stops a prior \fBthread::wait\fR command\&. Execution of the script passed to newly created thread will continue from the \fBthread::wait\fR command\&. If \fBthread::wait\fR was the last command in the script, the thread will exit\&. The command returns empty result but may trigger Tcl error with the message "target thread died" in some situations\&. .TP \fBthread::exit\fR ?status? Use of this command is deprecated in favour of more advanced thread reservation system implemented with \fBthread::preserve\fR and \fBthread::release\fR commands\&. Support for \fBthread::exit\fR command will dissapear in some future major release of the extension\&. .sp This command forces a thread stuck in the \fBthread::wait\fR command to unconditionaly exit\&. The thread's exit status defaults to 666 and can be specified using the optional \fIstatus\fR argument\&. The execution of \fBthread::exit\fR command is guaranteed to leave the program memory in the unconsistent state, produce memory leaks and otherwise affect other subsytem(s) of the Tcl application in an unpredictable manner\&. The command returns empty result but may trigger Tcl error with the message "target thread died" in some situations\&. .TP \fBthread::names\fR This command returns a list of thread IDs\&. These are only for threads that have been created via \fBthread::create\fR command\&. If your application creates other threads at the C level, they are not reported by this command\&. .TP |
︙ | ︙ |
Changes to doc/thread.man.
︙ | ︙ | |||
195 196 197 198 199 200 201 | the script passed to newly created thread will continue from the [cmd thread::wait] command. If [cmd thread::wait] was the last command in the script, the thread will exit. The command returns empty result but may trigger Tcl error with the message "target thread died" in some situations. | | | | > | | | | | | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | the script passed to newly created thread will continue from the [cmd thread::wait] command. If [cmd thread::wait] was the last command in the script, the thread will exit. The command returns empty result but may trigger Tcl error with the message "target thread died" in some situations. [call [cmd thread::exit] [opt status]] Use of this command is deprecated in favour of more advanced thread reservation system implemented with [cmd thread::preserve] and [cmd thread::release] commands. Support for [cmd thread::exit] command will dissapear in some future major release of the extension. [para] This command forces a thread stuck in the [cmd thread::wait] command to unconditionaly exit. The thread's exit status defaults to 666 and can be specified using the optional [arg status] argument. The execution of [cmd thread::exit] command is guaranteed to leave the program memory in the unconsistent state, produce memory leaks and otherwise affect other subsytem(s) of the Tcl application in an unpredictable manner. The command returns empty result but may trigger Tcl error with the message "target thread died" in some situations. [call [cmd thread::names]] This command returns a list of thread IDs. These are only for threads that have been created via [cmd thread::create] command. If your application creates other threads at the C level, they are not reported by this command. |
︙ | ︙ |
Changes to generic/threadCmd.c.
︙ | ︙ | |||
781 782 783 784 785 786 787 788 789 790 791 | static int ThreadExitObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *const objv[]; /* Argument objects. */ { Init(interp); ListRemove(NULL); | > > > > > > > > > > > > > | | 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 | static int ThreadExitObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *const objv[]; /* Argument objects. */ { int status = 666; Init(interp); if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?status?"); return TCL_ERROR; } if (objc == 2) { if (Tcl_GetIntFromObj(interp, objv[1], &status) != TCL_OK) { return TCL_ERROR; } } ListRemove(NULL); Tcl_ExitThread(status); return TCL_OK; /* NOT REACHED */ } /* *---------------------------------------------------------------------- * |
︙ | ︙ |
Changes to tests/thread.test.
︙ | ︙ | |||
142 143 144 145 146 147 148 149 150 151 152 153 154 155 | test thread-7.0 {thread::exit} { ThreadReap set tid [thread::create -joinable {thread::exit}] set c [thread::join $tid] ThreadReap set c } {666} test thread-8.0 {thread::exists - true} { ThreadReap set c [thread::exists [thread::create]] ThreadReap set c } {1} | > > > > > > > > > > > > > > > > > > > > | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | test thread-7.0 {thread::exit} { ThreadReap set tid [thread::create -joinable {thread::exit}] set c [thread::join $tid] ThreadReap set c } {666} test thread-7.1 {thread::exit - # args} { set tid [thread::create] catch {thread::send $tid {thread::exit 1 0}} msg set msg } {wrong # args: should be "thread::exit ?status?"} test thread-7.2 {thread::exit - args} { set tid [thread::create] catch {thread::send $tid {thread::exit foo}} msg set msg } {expected integer but got "foo"} test thread-7.3 {thread::exit - status} { ThreadReap set tid [thread::create -joinable {thread::exit 0}] set c [thread::join $tid] ThreadReap set c } {0} test thread-8.0 {thread::exists - true} { ThreadReap set c [thread::exists [thread::create]] ThreadReap set c } {1} |
︙ | ︙ |