summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-03-29 10:17:02 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-03-29 10:17:02 (GMT)
commit77ccaefbb1482145de9b9276979318e88b9e542e (patch)
tree6c0e252eb1d3890dc31bf60bd2f00ece3a4284e1
parent43308bf3c516fbe56b41a2d8e4ea948c63603b3e (diff)
downloadtcl-77ccaefbb1482145de9b9276979318e88b9e542e.zip
tcl-77ccaefbb1482145de9b9276979318e88b9e542e.tar.gz
tcl-77ccaefbb1482145de9b9276979318e88b9e542e.tar.bz2
Eliminate AT_FORK_INIT_VALUE/RESET_ATFORK_MUTEX macro's, since other values than the default are not supported anyway. This results in the elimination of (empty functions anyway) AtForkPrepare/AtForkParent.
Also improve consistancy in some variable names. No change of functionality.
-rw-r--r--unix/tclUnixNotfy.c70
-rw-r--r--win/tclWinNotify.c8
-rw-r--r--win/tclWinSock.c17
3 files changed, 15 insertions, 80 deletions
diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c
index 1457890..3422089 100644
--- a/unix/tclUnixNotfy.c
+++ b/unix/tclUnixNotfy.c
@@ -1,7 +1,5 @@
-#define AT_FORK_INIT_VALUE 0
-#define RESET_ATFORK_MUTEX 1
/*
- * tclUnixNotify.c --
+ * tclUnixNotfy.c --
*
* This file contains the implementation of the select()-based
* Unix-specific notifier, which is the lowest-level part of the Tcl
@@ -197,9 +195,7 @@ static Tcl_ThreadId notifierThread;
#ifdef TCL_THREADS
static void NotifierThreadProc(ClientData clientData);
#if defined(HAVE_PTHREAD_ATFORK)
-static int atForkInit = AT_FORK_INIT_VALUE;
-static void AtForkPrepare(void);
-static void AtForkParent(void);
+static int atForkInit = 0;
static void AtForkChild(void);
#endif /* HAVE_PTHREAD_ATFORK */
#endif /* TCL_THREADS */
@@ -256,7 +252,7 @@ extern unsigned char __stdcall TranslateMessage(const MSG *);
* Threaded-cygwin specific constants and functions in this file:
*/
-static const WCHAR NotfyClassName[] = L"TclNotifier";
+static const WCHAR className[] = L"TclNotifier";
static DWORD __stdcall NotifierProc(void *hwnd, unsigned int message,
void *wParam, void *lParam);
#endif /* TCL_THREADS && __CYGWIN__ */
@@ -345,7 +341,7 @@ Tcl_InitNotifier(void)
class.hInstance = TclWinGetTclInstance();
class.hbrBackground = NULL;
class.lpszMenuName = NULL;
- class.lpszClassName = NotfyClassName;
+ class.lpszClassName = className;
class.lpfnWndProc = NotifierProc;
class.hIcon = NULL;
class.hCursor = NULL;
@@ -370,7 +366,7 @@ Tcl_InitNotifier(void)
*/
if (!atForkInit) {
- int result = pthread_atfork(AtForkPrepare, AtForkParent, AtForkChild);
+ int result = pthread_atfork(NULL, NULL, AtForkChild);
if (result) {
Tcl_Panic("Tcl_InitNotifier: pthread_atfork failed");
@@ -1351,54 +1347,6 @@ NotifierThreadProc(
/*
*----------------------------------------------------------------------
*
- * AtForkPrepare --
- *
- * Lock the notifier in preparation for a fork.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-AtForkPrepare(void)
-{
-#if RESET_ATFORK_MUTEX == 0
- pthread_mutex_lock(&notifierInitMutex);
-#endif
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * AtForkParent --
- *
- * Unlock the notifier in the parent after a fork.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-AtForkParent(void)
-{
-#if RESET_ATFORK_MUTEX == 0
- pthread_mutex_unlock(&notifierInitMutex);
-#endif
-}
-
-/*
- *----------------------------------------------------------------------
- *
* AtForkChild --
*
* Unlock and reinstall the notifier in the child after a fork.
@@ -1418,12 +1366,8 @@ AtForkChild(void)
if (notifierThreadRunning == 1) {
pthread_cond_destroy(&notifierCV);
}
-#if RESET_ATFORK_MUTEX == 0
- pthread_mutex_unlock(&notifierInitMutex);
-#else
pthread_mutex_init(&notifierInitMutex, NULL);
pthread_mutex_init(&notifierMutex, NULL);
-#endif
pthread_cond_init(&notifierCV, NULL);
/*
@@ -1455,8 +1399,8 @@ AtForkChild(void)
*/
#ifdef __CYGWIN__
DestroyWindow(tsdPtr->hwnd);
- tsdPtr->hwnd = CreateWindowExW(NULL, NotfyClassName,
- NotfyClassName, 0, 0, 0, 0, 0, NULL, NULL,
+ tsdPtr->hwnd = CreateWindowExW(NULL, className,
+ className, 0, 0, 0, 0, 0, NULL, NULL,
TclWinGetTclInstance(), NULL);
ResetEvent(tsdPtr->event);
#else
diff --git a/win/tclWinNotify.c b/win/tclWinNotify.c
index 4543b02..ea4035b 100644
--- a/win/tclWinNotify.c
+++ b/win/tclWinNotify.c
@@ -50,7 +50,7 @@ static Tcl_ThreadDataKey dataKey;
*/
static int notifierCount = 0;
-static const TCHAR classname[] = TEXT("TclNotifier");
+static const TCHAR className[] = TEXT("TclNotifier");
TCL_DECLARE_MUTEX(notifierMutex)
/*
@@ -98,7 +98,7 @@ Tcl_InitNotifier(void)
class.hInstance = TclWinGetTclInstance();
class.hbrBackground = NULL;
class.lpszMenuName = NULL;
- class.lpszClassName = classname;
+ class.lpszClassName = className;
class.lpfnWndProc = NotifierProc;
class.hIcon = NULL;
class.hCursor = NULL;
@@ -186,7 +186,7 @@ Tcl_FinalizeNotifier(
Tcl_MutexLock(&notifierMutex);
notifierCount--;
if (notifierCount == 0) {
- UnregisterClass(classname, TclWinGetTclInstance());
+ UnregisterClass(className, TclWinGetTclInstance());
}
Tcl_MutexUnlock(&notifierMutex);
}
@@ -350,7 +350,7 @@ Tcl_ServiceModeHook(
*/
if (mode == TCL_SERVICE_ALL && !tsdPtr->hwnd) {
- tsdPtr->hwnd = CreateWindow(classname, classname,
+ tsdPtr->hwnd = CreateWindow(className, className,
WS_TILED, 0, 0, 0, 0, NULL, NULL, TclWinGetTclInstance(),
NULL);
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index a022ed5..c71aa96 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -62,15 +62,6 @@
#undef TCL_FEATURE_KEEPALIVE_NAGLE
/*
- * Make sure to remove the redirection defines set in tclWinPort.h that is in
- * use in other sections of the core, except for us.
- */
-
-#undef getservbyname
-#undef getsockopt
-#undef setsockopt
-
-/*
* Helper macros to make parts of this file clearer. The macros do exactly
* what they say on the tin. :-) They also only ever refer to their arguments
* once, and so can be used without regard to side effects.
@@ -90,7 +81,7 @@
*/
static int initialized = 0;
-static const TCHAR classname[] = TEXT("TclSocket");
+static const TCHAR className[] = TEXT("TclSocket");
TCL_DECLARE_MUTEX(socketMutex)
/*
@@ -2336,7 +2327,7 @@ InitSockets(void)
windowClass.hInstance = TclWinGetTclInstance();
windowClass.hbrBackground = NULL;
windowClass.lpszMenuName = NULL;
- windowClass.lpszClassName = classname;
+ windowClass.lpszClassName = className;
windowClass.lpfnWndProc = SocketProc;
windowClass.hIcon = NULL;
windowClass.hCursor = NULL;
@@ -2466,7 +2457,7 @@ SocketExitHandler(
*/
TclpFinalizeSockets();
- UnregisterClass(classname, TclWinGetTclInstance());
+ UnregisterClass(className, TclWinGetTclInstance());
initialized = 0;
Tcl_MutexUnlock(&socketMutex);
}
@@ -2992,7 +2983,7 @@ SocketThread(
* Create a dummy window receiving socket events.
*/
- tsdPtr->hwnd = CreateWindow(classname, classname, WS_TILED, 0, 0, 0, 0,
+ tsdPtr->hwnd = CreateWindow(className, className, WS_TILED, 0, 0, 0, 0,
NULL, NULL, windowClass.hInstance, arg);
/*