summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/tclWinInit.c46
-rw-r--r--win/tclWinThrd.c18
2 files changed, 14 insertions, 50 deletions
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index 8328bb9..16fb280 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -7,7 +7,7 @@
* Copyright (c) 1998-1999 by Scriptics Corporation.
* All rights reserved.
*
- * RCS: @(#) $Id: tclWinInit.c,v 1.22.2.2 2001/08/24 16:19:10 dgp Exp $
+ * RCS: @(#) $Id: tclWinInit.c,v 1.22.2.3 2001/09/01 22:53:45 davygrvy Exp $
*/
#include "tclWinInt.h"
@@ -73,12 +73,6 @@ static char* processors[NUMPROCESSORS] = {
};
/*
- * Thread id used for asynchronous notification from signal handlers.
- */
-
-static DWORD mainThreadId;
-
-/*
* The Init script (common to Windows and Unix platforms) is
* defined in tkInitScript.h
*/
@@ -129,16 +123,6 @@ TclpInitPlatform()
SetErrorMode(SetErrorMode(0) | SEM_FAILCRITICALERRORS);
- /*
- * Save the id of the first thread to intialize the Tcl library. This
- * thread will be used to handle notifications from async event
- * procedures. This is not strictly correct. A better solution involves
- * using a designated "main" notifier that is kept up to date as threads
- * come and go.
- */
-
- mainThreadId = GetCurrentThreadId();
-
#ifdef STATIC_BUILD
/*
* If we are in a statically linked executable, then we need to
@@ -827,31 +811,3 @@ Tcl_SourceRCFile(interp)
Tcl_DStringFree(&temp);
}
}
-
-/*
- *----------------------------------------------------------------------
- *
- * TclpAsyncMark --
- *
- * Wake up the main thread from a signal handler.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Sends a message to the main thread.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TclpAsyncMark(async)
- Tcl_AsyncHandler async; /* Token for handler. */
-{
- /*
- * Need a way to kick the Windows event loop and tell it to go look at
- * asynchronous events.
- */
-
- PostThreadMessage(mainThreadId, WM_USER, 0, 0);
-}
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c
index 8fe2596..f76adf2 100644
--- a/win/tclWinThrd.c
+++ b/win/tclWinThrd.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinThrd.c,v 1.8 2000/04/20 01:30:20 hobbs Exp $
+ * RCS: @(#) $Id: tclWinThrd.c,v 1.8.2.1 2001/09/01 22:53:45 davygrvy Exp $
*/
#include "tclWinInt.h"
@@ -123,13 +123,19 @@ Tcl_CreateThread(idPtr, proc, clientData, stackSize, flags)
int flags; /* Flags controlling behaviour of
* the new thread */
{
- unsigned long code;
+ HANDLE tHandle;
- code = _beginthreadex(NULL, stackSize, proc, clientData, 0,
- (unsigned *)idPtr);
- if (code == 0) {
+ tHandle = (HANDLE) _beginthreadex(NULL, (unsigned) stackSize, proc,
+ clientData, 0, (unsigned *)idPtr);
+
+ if (tHandle == NULL) {
return TCL_ERROR;
} else {
+ /*
+ * The only purpose of this is to decrement the reference count so the
+ * OS resources will be reaquired when the thread closes.
+ */
+ CloseHandle(tHandle);
return TCL_OK;
}
}
@@ -428,6 +434,7 @@ TclpFinalizeMutex(mutexPtr)
{
CRITICAL_SECTION *csPtr = *(CRITICAL_SECTION **)mutexPtr;
if (csPtr != NULL) {
+ DeleteCriticalSection(csPtr);
ckfree((char *)csPtr);
*mutexPtr = NULL;
}
@@ -896,6 +903,7 @@ TclpFinalizeCondition(condPtr)
*/
if (winCondPtr != NULL) {
+ DeleteCriticalSection(&winCondPtr->condLock);
ckfree((char *)winCondPtr);
*condPtr = NULL;
}