116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
* Access to the list of threads and to the thread send results is guarded by
* this mutex.
*/
TCL_DECLARE_MUTEX(threadMutex)
static int ThreadObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int ThreadCreate(Tcl_Interp *interp, const char *script,
int joinable);
static int ThreadList(Tcl_Interp *interp);
static int ThreadSend(Tcl_Interp *interp, Tcl_ThreadId id,
const char *script, int wait);
static int ThreadCancel(Tcl_Interp *interp, Tcl_ThreadId id,
|
|
|
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
* Access to the list of threads and to the thread send results is guarded by
* this mutex.
*/
TCL_DECLARE_MUTEX(threadMutex)
static int ThreadObjCmd(void *clientData,
Tcl_Interp *interp, size_t objc,
Tcl_Obj *const objv[]);
static int ThreadCreate(Tcl_Interp *interp, const char *script,
int joinable);
static int ThreadList(Tcl_Interp *interp);
static int ThreadSend(Tcl_Interp *interp, Tcl_ThreadId id,
const char *script, int wait);
static int ThreadCancel(Tcl_Interp *interp, Tcl_ThreadId id,
|
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
*----------------------------------------------------------------------
*/
static int
ThreadObjCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
static const char *const threadOptions[] = {
"cancel", "create", "event", "exit", "id",
"join", "names", "send", "wait", "errorproc",
NULL
|
|
|
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
*----------------------------------------------------------------------
*/
static int
ThreadObjCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
size_t objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
static const char *const threadOptions[] = {
"cancel", "create", "event", "exit", "id",
"join", "names", "send", "wait", "errorproc",
NULL
|
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
|
Tcl_MutexUnlock(&threadMutex);
}
switch (option) {
case THREAD_CANCEL: {
Tcl_WideInt id;
const char *result;
int flags, arg;
if ((objc < 3) || (objc > 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "?-unwind? id ?result?");
return TCL_ERROR;
}
flags = 0;
arg = 2;
|
|
>
|
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
|
Tcl_MutexUnlock(&threadMutex);
}
switch (option) {
case THREAD_CANCEL: {
Tcl_WideInt id;
const char *result;
int flags;
size_t arg;
if ((objc < 3) || (objc > 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "?-unwind? id ?result?");
return TCL_ERROR;
}
flags = 0;
arg = 2;
|