summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-05-23 19:31:15 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-05-23 19:31:15 (GMT)
commitedb38932e8f071b1326515067d41bc060807dec2 (patch)
tree412b577e1bff527cbc9e106fca9f744233b6fe8d
parent46aab3eb09ed92b1b43e3d08484dfe88efe06cab (diff)
downloadtcl-edb38932e8f071b1326515067d41bc060807dec2.zip
tcl-edb38932e8f071b1326515067d41bc060807dec2.tar.gz
tcl-edb38932e8f071b1326515067d41bc060807dec2.tar.bz2
Unbreak build with other CFLAGS, such as TCL_MEM_DEBUG=1 or TCL_THREADS=0 on Linux
-rw-r--r--generic/tclInt.h23
-rw-r--r--generic/tclThread.c4
-rw-r--r--unix/tclUnixThrd.c6
3 files changed, 26 insertions, 7 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index a29dae8..879d3ae 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -136,6 +136,26 @@ typedef int ptrdiff_t;
# define vsnprintf _vsnprintf
#endif
+#if !defined(TCL_THREADS)
+# define TCL_THREADS 1
+#endif
+#if !TCL_THREADS
+# undef TCL_DECLARE_MUTEX
+# define TCL_DECLARE_MUTEX(name)
+# undef Tcl_MutexLock
+# define Tcl_MutexLock(mutexPtr)
+# undef Tcl_MutexUnlock
+# define Tcl_MutexUnlock(mutexPtr)
+# undef Tcl_MutexFinalize
+# define Tcl_MutexFinalize(mutexPtr)
+# undef Tcl_ConditionNotify
+# define Tcl_ConditionNotify(condPtr)
+# undef Tcl_ConditionWait
+# define Tcl_ConditionWait(condPtr, mutexPtr, timePtr)
+# undef Tcl_ConditionFinalize
+# define Tcl_ConditionFinalize(condPtr)
+#endif
+
/*
* The following procedures allow namespaces to be customized to support
* special name resolution rules for commands/variables.
@@ -4200,9 +4220,6 @@ typedef const char *TclDTraceStr;
} \
}
-#if !defined(TCL_THREADS)
-# define TCL_THREADS 1
-#endif
#if TCL_THREADS && !defined(USE_THREAD_ALLOC)
# define USE_THREAD_ALLOC 1
#endif
diff --git a/generic/tclThread.c b/generic/tclThread.c
index 8def429..cafd824 100644
--- a/generic/tclThread.c
+++ b/generic/tclThread.c
@@ -254,6 +254,7 @@ TclRememberMutex(
*----------------------------------------------------------------------
*/
+#undef Tcl_MutexFinalize
void
Tcl_MutexFinalize(
Tcl_Mutex *mutexPtr)
@@ -307,6 +308,7 @@ TclRememberCondition(
*----------------------------------------------------------------------
*/
+#undef Tcl_ConditionFinalize
void
Tcl_ConditionFinalize(
Tcl_Condition *condPtr)
@@ -458,9 +460,7 @@ Tcl_ExitThread(
int status)
{
Tcl_FinalizeThread();
-#if TCL_THREADS
TclpThreadExit(status);
-#endif
}
#if !TCL_THREADS
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c
index 6ea258f..24c269d 100644
--- a/unix/tclUnixThrd.c
+++ b/unix/tclUnixThrd.c
@@ -166,7 +166,6 @@ Tcl_JoinThread(
#endif
}
-#if 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 */
+}
/*
*----------------------------------------------------------------------