| ︙ | | |
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
-
+
|
static CRITICAL_SECTION initLock;
/*
* allocLock is used by Tcl's version of malloc for synchronization. For
* obvious reasons, cannot use any dyamically allocated storage.
*/
#ifdef TCL_THREADS
#if !defined(TCL_THREADS) || TCL_THREADS
static struct Tcl_Mutex_ {
CRITICAL_SECTION crit;
} allocLock;
static Tcl_Mutex allocLockPtr = &allocLock;
static int allocOnce = 0;
|
| ︙ | | |
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
-
+
|
* Condition Variable implementation.
*/
/*
* The per-thread event and queue pointers.
*/
#ifdef TCL_THREADS
#if !defined(TCL_THREADS) || TCL_THREADS
typedef struct ThreadSpecificData {
HANDLE condEvent; /* Per-thread condition event */
struct ThreadSpecificData *nextPtr; /* Queue pointers */
struct ThreadSpecificData *prevPtr;
int flags; /* See flags below */
} ThreadSpecificData;
|
| ︙ | | |
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
|
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
|
-
+
|
*
*----------------------------------------------------------------------
*/
Tcl_Mutex *
Tcl_GetAllocMutex(void)
{
#ifdef TCL_THREADS
#if !defined(TCL_THREADS) || TCL_THREADS
if (!allocOnce) {
InitializeCriticalSection(&allocLock.crit);
allocOnce = 1;
}
return &allocLockPtr;
#else
return NULL;
|
| ︙ | | |
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
538
539
540
541
542
|
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
538
539
540
541
542
|
-
+
-
+
|
/*
* Destroy the critical section that we are holding!
*/
DeleteCriticalSection(&masterLock);
initialized = 0;
#ifdef TCL_THREADS
#if !defined(TCL_THREADS) || TCL_THREADS
if (allocOnce) {
DeleteCriticalSection(&allocLock.crit);
allocOnce = 0;
}
#endif
LeaveCriticalSection(&initLock);
/*
* Destroy the critical section that we were holding.
*/
DeleteCriticalSection(&initLock);
}
#ifdef TCL_THREADS
#if !defined(TCL_THREADS) || TCL_THREADS
/* locally used prototype */
static void FinalizeConditionEvent(ClientData data);
/*
*----------------------------------------------------------------------
*
|
| ︙ | | |