Commit 7f632b8f authored by unknown's avatar unknown

This patch handles compiles with threads, namely if you don't have pthreads it...

This patch handles compiles with threads, namely if you don't have pthreads it will remove support for threads in the applications (and it is fixed in such a way that tests won't break).


client/mysqlimport.c:
  Add in flags to support compiles with no thread support.
client/mysqlslap.c:
  Add support to source code to compile without threads.
parent c4d5fd88
...@@ -29,12 +29,16 @@ ...@@ -29,12 +29,16 @@
#include "client_priv.h" #include "client_priv.h"
#include "mysql_version.h" #include "mysql_version.h"
#ifdef HAVE_LIBPTHREAD
#include <my_pthread.h> #include <my_pthread.h>
#endif
/* Global Thread counter */ /* Global Thread counter */
int counter= 0; int counter= 0;
#ifdef HAVE_LIBPTHREAD
pthread_mutex_t counter_mutex; pthread_mutex_t counter_mutex;
#endif
static void db_error_with_table(MYSQL *mysql, char *table); static void db_error_with_table(MYSQL *mysql, char *table);
static void db_error(MYSQL *mysql); static void db_error(MYSQL *mysql);
...@@ -516,6 +520,7 @@ static char *field_escape(char *to,const char *from,uint length) ...@@ -516,6 +520,7 @@ static char *field_escape(char *to,const char *from,uint length)
int exitcode= 0; int exitcode= 0;
#ifdef HAVE_LIBPTHREAD
pthread_handler_t worker_thread(void *arg) pthread_handler_t worker_thread(void *arg)
{ {
int error; int error;
...@@ -554,6 +559,7 @@ pthread_handler_t worker_thread(void *arg) ...@@ -554,6 +559,7 @@ pthread_handler_t worker_thread(void *arg)
return 0; return 0;
} }
#endif
int main(int argc, char **argv) int main(int argc, char **argv)
...@@ -571,6 +577,7 @@ int main(int argc, char **argv) ...@@ -571,6 +577,7 @@ int main(int argc, char **argv)
return(1); return(1);
} }
#ifdef HAVE_LIBPTHREAD
if (opt_use_threads && !lock_tables) if (opt_use_threads && !lock_tables)
{ {
pthread_t mainthread; /* Thread descriptor */ pthread_t mainthread; /* Thread descriptor */
...@@ -621,6 +628,7 @@ int main(int argc, char **argv) ...@@ -621,6 +628,7 @@ int main(int argc, char **argv)
VOID(pthread_mutex_destroy(&counter_mutex)); VOID(pthread_mutex_destroy(&counter_mutex));
} }
else else
#endif
{ {
MYSQL *mysql= 0; MYSQL *mysql= 0;
if (!(mysql= db_connect(current_host,current_db,current_user,opt_password))) if (!(mysql= db_connect(current_host,current_db,current_user,opt_password)))
......
...@@ -76,7 +76,9 @@ ...@@ -76,7 +76,9 @@
#define RAND_STRING_SIZE 126 #define RAND_STRING_SIZE 126
#include "client_priv.h" #include "client_priv.h"
#ifdef HAVE_LIBPTHREAD
#include <my_pthread.h> #include <my_pthread.h>
#endif
#include <my_sys.h> #include <my_sys.h>
#include <m_string.h> #include <m_string.h>
#include <mysql.h> #include <mysql.h>
...@@ -987,6 +989,7 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit) ...@@ -987,6 +989,7 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
exit(0); exit(0);
} }
#ifdef HAVE_LIBPTHREAD
if (opt_use_threads) if (opt_use_threads)
{ {
pthread_t mainthread; /* Thread descriptor */ pthread_t mainthread; /* Thread descriptor */
...@@ -1008,8 +1011,11 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit) ...@@ -1008,8 +1011,11 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
} }
} }
} }
#endif
#ifndef __WIN__ #ifndef __WIN__
#ifdef HAVE_LIBPTHREAD
else else
#endif
{ {
fflush(NULL); fflush(NULL);
for (x= 0; x < concur; x++) for (x= 0; x < concur; x++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment