Diff
Not logged in

Differences From Artifact [03813ab89d]:

To Artifact [2c6b87b444]:


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
224
225
226
227
228
229
230
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
224
225
226
227
228
229







-
+




-
+










-
+
-







 *----------------------------------------------------------------------
 */

int
TclpThreadCreate(
    Tcl_ThreadId *idPtr,	/* Return, the ID of the thread. */
    Tcl_ThreadCreateProc *proc,	/* Main() function of the thread. */
    ClientData clientData,	/* The one argument to Main(). */
    void *clientData,	/* The one argument to Main(). */
	TCL_HASH_TYPE stackSize,	/* Size of stack for the new thread. */
    int flags)			/* Flags controlling behaviour of the new
				 * thread. */
{
    WinThread *winThreadPtr;		/* Per-thread startup info */
    WinThread *winThreadPtr;	/* Per-thread startup info */
    HANDLE tHandle;

    winThreadPtr = (WinThread *)ckalloc(sizeof(WinThread));
    winThreadPtr->lpStartAddress = (LPTHREAD_START_ROUTINE) proc;
    winThreadPtr->lpParameter = clientData;
    winThreadPtr->fpControl = _controlfp(0, 0);

    EnterCriticalSection(&joinLock);

    *idPtr = 0; /* must initialize as Tcl_Thread is a pointer and
                 * on WIN64 sizeof void* != sizeof unsigned
                 * on WIN64 sizeof void* != sizeof unsigned */
		 */

#if defined(_MSC_VER) || defined(__MSVCRT__)
    tHandle = (HANDLE) _beginthreadex(NULL, (unsigned)stackSize,
	    (Tcl_ThreadCreateProc*) TclWinThreadStart, winThreadPtr,
	    0, (unsigned *)idPtr);
#else
    tHandle = CreateThread(NULL, (DWORD)stackSize,
531
532
533
534
535
536
537
538

539
540
541
542
543
544
545
530
531
532
533
534
535
536

537
538
539
540
541
542
543
544







-
+








    DeleteCriticalSection(&initLock);
}

#if TCL_THREADS

/* locally used prototype */
static void		FinalizeConditionEvent(ClientData data);
static void		FinalizeConditionEvent(void *data);

/*
 *----------------------------------------------------------------------
 *
 * Tcl_MutexLock --
 *
 *	This procedure is invoked to lock a mutex. This is a self initializing
876
877
878
879
880
881
882
883

884
885
886
887
888
889
890
875
876
877
878
879
880
881

882
883
884
885
886
887
888
889







-
+







 *	The per-thread event is closed.
 *
 *----------------------------------------------------------------------
 */

static void
FinalizeConditionEvent(
    ClientData data)
    void *data)
{
    ThreadSpecificData *tsdPtr = (ThreadSpecificData *) data;

    tsdPtr->flags = WIN_THREAD_UNINIT;
    CloseHandle(tsdPtr->condEvent);
}