summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-05-22 20:53:24 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-05-22 20:53:24 (GMT)
commitce025f259b91e61857e70c6690d5db631b5dc747 (patch)
treef175e43fb180d0b756186a839cbeee766ec8e27c /unix
parentf6af18a9476f566a34901b828e33f7141266174c (diff)
downloadtcl-ce025f259b91e61857e70c6690d5db631b5dc747.zip
tcl-ce025f259b91e61857e70c6690d5db631b5dc747.tar.gz
tcl-ce025f259b91e61857e70c6690d5db631b5dc747.tar.bz2
Simplify usage of TCL_THREAD, along the lines of [eeddb0693a950be980a66de3811630a00c7bab54|eeddb0693a]. Suggested by DKF
Diffstat (limited to 'unix')
-rw-r--r--unix/tclEpollNotfy.c2
-rw-r--r--unix/tclKqueueNotfy.c2
-rw-r--r--unix/tclSelectNotfy.c22
-rw-r--r--unix/tclUnixCompat.c14
-rw-r--r--unix/tclUnixFCmd.c2
-rw-r--r--unix/tclUnixInit.c2
-rw-r--r--unix/tclUnixNotfy.c8
-rw-r--r--unix/tclUnixThrd.c28
8 files changed, 40 insertions, 40 deletions
diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c
index 3059643..b3ee57a 100644
--- a/unix/tclEpollNotfy.c
+++ b/unix/tclEpollNotfy.c
@@ -12,7 +12,7 @@
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#if defined(NOTIFIER_EPOLL) && (!defined(TCL_THREADS) || TCL_THREADS)
+#if defined(NOTIFIER_EPOLL) && TCL_THREADS
#define _GNU_SOURCE /* For pipe2(2) */
#include "tclInt.h"
diff --git a/unix/tclKqueueNotfy.c b/unix/tclKqueueNotfy.c
index 3fddeea..da52d96 100644
--- a/unix/tclKqueueNotfy.c
+++ b/unix/tclKqueueNotfy.c
@@ -13,7 +13,7 @@
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#if defined(NOTIFIER_KQUEUE) && (!defined(TCL_THREADS) || TCL_THREADS)
+#if defined(NOTIFIER_KQUEUE) && TCL_THREADS
#include "tclInt.h"
#ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier is
diff --git a/unix/tclSelectNotfy.c b/unix/tclSelectNotfy.c
index 3172d6a..58dc742 100644
--- a/unix/tclSelectNotfy.c
+++ b/unix/tclSelectNotfy.c
@@ -11,7 +11,7 @@
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#if (!defined(NOTIFIER_EPOLL) && !defined(NOTIFIER_KQUEUE)) || (defined(TCL_THREADS) && !TCL_THREADS)
+#if (!defined(NOTIFIER_EPOLL) && !defined(NOTIFIER_KQUEUE)) || !TCL_THREADS
#include "tclInt.h"
#ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier is
@@ -81,7 +81,7 @@ typedef struct ThreadSpecificData {
int numFdBits; /* Number of valid bits in checkMasks (one
* more than highest fd for which
* Tcl_WatchFile has been called). */
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
int onList; /* True if it is in this list */
unsigned int pollState; /* pollState is used to implement a polling
* handshake between each thread and the
@@ -112,7 +112,7 @@ typedef struct ThreadSpecificData {
static Tcl_ThreadDataKey dataKey;
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
/*
* The following static indicates the number of threads that have initialized
* notifiers.
@@ -193,7 +193,7 @@ static Tcl_ThreadId notifierThread;
* Static routines defined in this file.
*/
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
static TCL_NORETURN void NotifierThreadProc(ClientData clientData);
#if defined(HAVE_PTHREAD_ATFORK)
static int atForkInit = 0;
@@ -285,7 +285,7 @@ Tcl_InitNotifier(void)
} else {
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
tsdPtr->eventReady = 0;
/*
@@ -370,7 +370,7 @@ Tcl_FinalizeNotifier(
tclNotifierHooks.finalizeNotifierProc(clientData);
return;
} else {
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
pthread_mutex_lock(&notifierInitMutex);
@@ -640,7 +640,7 @@ Tcl_WaitForEvent(
FileHandler *filePtr;
int mask;
Tcl_Time vTime;
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
int waitForFiles;
# ifdef __CYGWIN__
MSG msg;
@@ -675,7 +675,7 @@ Tcl_WaitForEvent(
tclScaleTimeProcPtr(&vTime, tclTimeClientData);
timePtr = &vTime;
}
-#if defined(TCL_THREADS) && !TCL_THREADS
+#if !TCL_THREADS
timeout.tv_sec = timePtr->sec;
timeout.tv_usec = timePtr->usec;
timeoutPtr = &timeout;
@@ -694,7 +694,7 @@ Tcl_WaitForEvent(
#endif /* !TCL_THREADS */
}
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
/*
* Start notifier thread and place this thread on the list of
* interested threads, signal the notifier thread, and wait for a
@@ -885,14 +885,14 @@ Tcl_WaitForEvent(
}
filePtr->readyMask = mask;
}
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
pthread_mutex_unlock(&notifierMutex);
#endif /* TCL_THREADS */
return 0;
}
}
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
/*
*----------------------------------------------------------------------
diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c
index 2d2e53b..aa25c6b 100644
--- a/unix/tclUnixCompat.c
+++ b/unix/tclUnixCompat.c
@@ -47,7 +47,7 @@
* library calls.
*/
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
typedef struct {
struct passwd pwd;
@@ -182,7 +182,7 @@ struct passwd *
TclpGetPwNam(
const char *name)
{
-#if defined(TCL_THREADS) && !TCL_THREADS
+#if !TCL_THREADS
return getpwnam(name);
#else
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -262,7 +262,7 @@ struct passwd *
TclpGetPwUid(
uid_t uid)
{
-#if defined(TCL_THREADS) && !TCL_THREADS
+#if !TCL_THREADS
return getpwuid(uid);
#else
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -365,7 +365,7 @@ struct group *
TclpGetGrNam(
const char *name)
{
-#if defined(TCL_THREADS) && !TCL_THREADS
+#if !TCL_THREADS
return getgrnam(name);
#else
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -445,7 +445,7 @@ struct group *
TclpGetGrGid(
gid_t gid)
{
-#if defined(TCL_THREADS) && !TCL_THREADS
+#if !TCL_THREADS
return getgrgid(gid);
#else
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -548,7 +548,7 @@ struct hostent *
TclpGetHostByName(
const char *name)
{
-#if (defined(TCL_THREADS) && !TCL_THREADS) || defined(HAVE_MTSAFE_GETHOSTBYNAME)
+#if !TCL_THREADS || defined(HAVE_MTSAFE_GETHOSTBYNAME)
return gethostbyname(name);
#else
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -618,7 +618,7 @@ TclpGetHostByAddr(
int length,
int type)
{
-#if (defined(TCL_THREADS) && !TCL_THREADS) || defined(HAVE_MTSAFE_GETHOSTBYADDR)
+#if !TCL_THREADS || defined(HAVE_MTSAFE_GETHOSTBYADDR)
return gethostbyaddr(addr, length, type);
#else
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c
index 2b2a613..548e96b 100644
--- a/unix/tclUnixFCmd.c
+++ b/unix/tclUnixFCmd.c
@@ -256,7 +256,7 @@ Realpath(
#endif /* PURIFY */
#ifndef NO_REALPATH
-#if defined(__APPLE__) && (!defined(TCL_THREADS) || TCL_THREADS) && \
+#if defined(__APPLE__) && TCL_THREADS && \
defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \
MAC_OS_X_VERSION_MIN_REQUIRED < 1030
/*
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 78d591a..b6b66da 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -316,7 +316,7 @@ static int MacOSXGetLibraryPath(Tcl_Interp *interp,
#endif /* HAVE_COREFOUNDATION */
#if defined(__APPLE__) && (defined(TCL_LOAD_FROM_MEMORY) || ( \
defined(MAC_OS_X_VERSION_MIN_REQUIRED) && ( \
- ((!defined(TCL_THREADS) || TCL_THREADS) && MAC_OS_X_VERSION_MIN_REQUIRED < 1030) || \
+ (TCL_THREADS && MAC_OS_X_VERSION_MIN_REQUIRED < 1030) || \
(defined(__LP64__) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050) || \
(defined(HAVE_COREFOUNDATION) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050)\
)))
diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c
index 6572b39..062d817 100644
--- a/unix/tclUnixNotfy.c
+++ b/unix/tclUnixNotfy.c
@@ -18,7 +18,7 @@
*/
static int FileHandlerEventProc(Tcl_Event *evPtr, int flags);
-#if defined(TCL_THREADS) && !TCL_THREADS
+#if !TCL_THREADS
# undef NOTIFIER_EPOLL
# undef NOTIFIER_KQUEUE
# define NOTIFIER_SELECT
@@ -106,7 +106,7 @@ Tcl_AlertNotifier(
return;
} else {
#ifdef NOTIFIER_SELECT
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
ThreadSpecificData *tsdPtr = clientData;
pthread_mutex_lock(&notifierMutex);
@@ -197,7 +197,7 @@ Tcl_ServiceModeHook(
return;
} else if (mode == TCL_SERVICE_ALL) {
#ifdef NOTIFIER_SELECT
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
StartNotifierThread("Tcl_ServiceModeHook");
#endif
#endif /* NOTIFIER_SELECT */
@@ -279,7 +279,7 @@ FileHandlerEventProc(
}
#ifdef NOTIFIER_SELECT
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
/*
*----------------------------------------------------------------------
*
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c
index 76228a3..6ea258f 100644
--- a/unix/tclUnixThrd.c
+++ b/unix/tclUnixThrd.c
@@ -13,7 +13,7 @@
#include "tclInt.h"
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
#ifndef TCL_NO_DEPRECATED
typedef struct {
@@ -74,7 +74,7 @@ TclpThreadCreate(
int flags) /* Flags controlling behaviour of the new
* thread. */
{
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
pthread_attr_t attr;
pthread_t theThread;
int result;
@@ -152,7 +152,7 @@ Tcl_JoinThread(
* thread we wait upon will be written into.
* May be NULL. */
{
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
int result;
unsigned long retcode, *retcodePtr = &retcode;
@@ -166,7 +166,7 @@ Tcl_JoinThread(
#endif
}
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
/*
*----------------------------------------------------------------------
*
@@ -210,7 +210,7 @@ TclpThreadExit(
Tcl_ThreadId
Tcl_GetCurrentThread(void)
{
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
return (Tcl_ThreadId) pthread_self();
#else
return (Tcl_ThreadId) 0;
@@ -239,7 +239,7 @@ Tcl_GetCurrentThread(void)
void
TclpInitLock(void)
{
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
pthread_mutex_lock(&initLock);
#endif
}
@@ -265,7 +265,7 @@ TclpInitLock(void)
void
TclFinalizeLock(void)
{
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
/*
* You do not need to destroy mutexes that were created with the
* PTHREAD_MUTEX_INITIALIZER macro. These mutexes do not need any
@@ -296,7 +296,7 @@ TclFinalizeLock(void)
void
TclpInitUnlock(void)
{
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
pthread_mutex_unlock(&initLock);
#endif
}
@@ -325,7 +325,7 @@ TclpInitUnlock(void)
void
TclpMasterLock(void)
{
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
pthread_mutex_lock(&masterLock);
#endif
}
@@ -351,7 +351,7 @@ TclpMasterLock(void)
void
TclpMasterUnlock(void)
{
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
pthread_mutex_unlock(&masterLock);
#endif
}
@@ -378,7 +378,7 @@ TclpMasterUnlock(void)
Tcl_Mutex *
Tcl_GetAllocMutex(void)
{
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
pthread_mutex_t **allocLockPtrPtr = &allocLockPtr;
return (Tcl_Mutex *) allocLockPtrPtr;
#else
@@ -386,7 +386,7 @@ Tcl_GetAllocMutex(void)
#endif
}
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
/*
*----------------------------------------------------------------------
@@ -659,7 +659,7 @@ char *
TclpInetNtoa(
struct in_addr addr)
{
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
unsigned char *b = (unsigned char*) &addr.s_addr;
@@ -671,7 +671,7 @@ TclpInetNtoa(
}
#endif /* TCL_NO_DEPRECATED */
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
/*
* Additions by AOL for specialized thread memory allocator.
*/