summaryrefslogtreecommitdiff
path: root/mysys/thr_lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'mysys/thr_lock.c')
-rw-r--r--mysys/thr_lock.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c
index 5c0803c6402..df360447e69 100644
--- a/mysys/thr_lock.c
+++ b/mysys/thr_lock.c
@@ -76,13 +76,14 @@ multiple read locks.
#endif
#include "mysys_priv.h"
+
+#ifdef THREAD
#include "thr_lock.h"
#include <m_string.h>
#include <errno.h>
my_bool thr_lock_inited=0;
-#ifdef THREAD
/* The following constants are only for debug output */
#define MAX_THREADS 100
@@ -1063,8 +1064,16 @@ void thr_print_locks(void)
pthread_mutex_unlock(&THR_LOCK_lock);
}
+#endif /* THREAD */
+
+/*****************************************************************************
+** Test of thread locks
+****************************************************************************/
+
#ifdef MAIN
+#ifdef THREAD
+
struct st_test {
uint lock_nr;
enum thr_lock_type lock_type;
@@ -1283,6 +1292,14 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
printf("Test succeeded\n");
return 0;
}
-#endif
-#endif
+#else /* THREAD */
+
+int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
+{
+ printf("thr_lock disabled because we are not using threads\n");
+ exit(1);
+}
+
+#endif /* THREAD */
+#endif /* MAIN */