summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixThrd.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix/tclUnixThrd.c')
-rw-r--r--unix/tclUnixThrd.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c
index 76228a3..24c269d 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,6 @@ Tcl_JoinThread(
#endif
}
-#if !defined(TCL_THREADS) || TCL_THREADS
/*
*----------------------------------------------------------------------
*
@@ -187,9 +186,12 @@ void
TclpThreadExit(
int status)
{
+#if TCL_THREADS
pthread_exit(INT2PTR(status));
-}
+#else /* TCL_THREADS */
+ exit(status);
#endif /* TCL_THREADS */
+}
/*
*----------------------------------------------------------------------
@@ -210,7 +212,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 +241,7 @@ Tcl_GetCurrentThread(void)
void
TclpInitLock(void)
{
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
pthread_mutex_lock(&initLock);
#endif
}
@@ -265,7 +267,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 +298,7 @@ TclFinalizeLock(void)
void
TclpInitUnlock(void)
{
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
pthread_mutex_unlock(&initLock);
#endif
}
@@ -325,7 +327,7 @@ TclpInitUnlock(void)
void
TclpMasterLock(void)
{
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
pthread_mutex_lock(&masterLock);
#endif
}
@@ -351,7 +353,7 @@ TclpMasterLock(void)
void
TclpMasterUnlock(void)
{
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
pthread_mutex_unlock(&masterLock);
#endif
}
@@ -378,7 +380,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 +388,7 @@ Tcl_GetAllocMutex(void)
#endif
}
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
/*
*----------------------------------------------------------------------
@@ -659,7 +661,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 +673,7 @@ TclpInetNtoa(
}
#endif /* TCL_NO_DEPRECATED */
-#if !defined(TCL_THREADS) || TCL_THREADS
+#if TCL_THREADS
/*
* Additions by AOL for specialized thread memory allocator.
*/