| ︙ | | |
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
+
|
/*
* allocLock is used by Tcl's version of malloc for synchronization.
* For obvious reasons, cannot use any dyamically allocated storage.
*/
static CRITICAL_SECTION allocLock;
static Tcl_Mutex allocLockPtr = (Tcl_Mutex) &allocLock;
/*
* Condition variables are implemented with a combination of a
* per-thread Windows Event and a per-condition waiting queue.
* The idea is that each thread has its own Event that it waits
* on when it is doing a ConditionWait; it uses the same event for
* all condition variables because it only waits on one at a time.
|
| ︙ | | |
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
-
|
* the first Tcl interpreter in a single threaded environment.
* Once the interpreter has been created, it is safe to create
* more threads that create interpreters in parallel.
*/
init = 1;
InitializeCriticalSection(&initLock);
InitializeCriticalSection(&masterLock);
InitializeCriticalSection(&allocLock);
}
EnterCriticalSection(&initLock);
}
/*
*----------------------------------------------------------------------
|
| ︙ | | |
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
|
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
* the first Tcl interpreter in a single threaded environment.
* Once the interpreter has been created, it is safe to create
* more threads that create interpreters in parallel.
*/
init = 1;
InitializeCriticalSection(&initLock);
InitializeCriticalSection(&masterLock);
InitializeCriticalSection(&allocLock);
}
EnterCriticalSection(&masterLock);
}
/*
*----------------------------------------------------------------------
*
* TclpMasterUnlock
*
* This procedure is used to release a lock that serializes creation
* and deletion of synchronization objects.
*
* Results:
* None.
*
* Side effects:
* Release the master mutex.
*
*----------------------------------------------------------------------
*/
void
TclpMasterUnlock()
{
LeaveCriticalSection(&masterLock);
}
/*
*----------------------------------------------------------------------
*
* Tcl_GetAllocMutex
*
* This procedure returns a pointer to a statically initialized
|
| ︙ | | |
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
|
296
297
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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
|
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
*----------------------------------------------------------------------
*/
Tcl_Mutex *
Tcl_GetAllocMutex()
{
#ifdef TCL_THREADS
InitializeCriticalSection(&allocLock);
return &allocLock;
return &allocLockPtr;
#else
return NULL;
#endif
}
#ifdef TCL_THREADS
/*
*----------------------------------------------------------------------
*
* TclpMasterUnlock
*
* This procedure is used to release a lock that serializes creation
* and deletion of synchronization objects.
*
* Results:
* None.
*
* Side effects:
* Release the master mutex.
*
*----------------------------------------------------------------------
*/
void
TclpMasterUnlock()
{
LeaveCriticalSection(&masterLock);
}
/*
*----------------------------------------------------------------------
*
* Tcl_MutexLock --
*
|
| ︙ | | |