50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#define MASTER_LOCK pthread_mutex_lock(&masterLock)
#define MASTER_UNLOCK pthread_mutex_unlock(&masterLock)
#endif /* TCL_THREADS */
#ifdef TCL_THREADS
/*
*----------------------------------------------------------------------
*
* Tcl_CreateThread --
*
* This procedure creates a new thread.
|
<
|
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#define MASTER_LOCK pthread_mutex_lock(&masterLock)
#define MASTER_UNLOCK pthread_mutex_unlock(&masterLock)
#endif /* TCL_THREADS */
/*
*----------------------------------------------------------------------
*
* Tcl_CreateThread --
*
* This procedure creates a new thread.
|
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
Tcl_ThreadId *idPtr; /* Return, the ID of the thread */
Tcl_ThreadCreateProc proc; /* Main() function of the thread */
ClientData clientData; /* The one argument to Main() */
int stackSize; /* Size of stack for the new thread */
int flags; /* Flags controlling behaviour of
* the new thread */
{
pthread_attr_t attr;
int result;
pthread_attr_init(&attr);
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
#ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE
|
>
|
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
Tcl_ThreadId *idPtr; /* Return, the ID of the thread */
Tcl_ThreadCreateProc proc; /* Main() function of the thread */
ClientData clientData; /* The one argument to Main() */
int stackSize; /* Size of stack for the new thread */
int flags; /* Flags controlling behaviour of
* the new thread */
{
#ifdef TCL_THREADS
pthread_attr_t attr;
int result;
pthread_attr_init(&attr);
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
#ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE
|
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
(void * (*)())proc, (void *)clientData)) {
result = TCL_ERROR;
} else {
result = TCL_OK;
}
pthread_attr_destroy(&attr);
return result;
}
/*
*----------------------------------------------------------------------
*
* TclpThreadExit --
*
* This procedure terminates the current thread.
*
|
>
>
>
>
|
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
(void * (*)())proc, (void *)clientData)) {
result = TCL_ERROR;
} else {
result = TCL_OK;
}
pthread_attr_destroy(&attr);
return result;
#else
return TCL_ERROR;
#endif /* TCL_THREADS */
}
#ifdef TCL_THREADS
/*
*----------------------------------------------------------------------
*
* TclpThreadExit --
*
* This procedure terminates the current thread.
*
|