diff options
author | dgp <dgp@users.sourceforge.net> | 2016-05-10 16:03:13 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2016-05-10 16:03:13 (GMT) |
commit | 08df07894566ad1a3cf2dc750ab9322761ee400f (patch) | |
tree | 620e18d988e661349d957eb09da1777d21f4b2f9 /unix/tclUnixNotfy.c | |
parent | 20baf86d1e03655bb6d7fae562091e95fe52db15 (diff) | |
parent | 313d238fb894ff0775f40ec5aee77627742a3b1b (diff) | |
download | tcl-08df07894566ad1a3cf2dc750ab9322761ee400f.zip tcl-08df07894566ad1a3cf2dc750ab9322761ee400f.tar.gz tcl-08df07894566ad1a3cf2dc750ab9322761ee400f.tar.bz2 |
merge trunkdgp_dup_encoding_fix
Diffstat (limited to 'unix/tclUnixNotfy.c')
-rw-r--r-- | unix/tclUnixNotfy.c | 70 |
1 files changed, 7 insertions, 63 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(¬ifierInitMutex); -#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(¬ifierInitMutex); -#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(¬ifierCV); } -#if RESET_ATFORK_MUTEX == 0 - pthread_mutex_unlock(¬ifierInitMutex); -#else pthread_mutex_init(¬ifierInitMutex, NULL); pthread_mutex_init(¬ifierMutex, NULL); -#endif pthread_cond_init(¬ifierCV, 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 |