Remove configuration preprocessor symbols 'THREAD'

and 'THREAD_SAFE_CLIENT'.
  
As of MySQL 5.5, we no longer support non-threaded
builds.   This patch removes all references to the
obsolete THREAD and THREAD_SAFE_CLIENT preprocessor
symbols.  These were used to distinguish between
threaded and non-threaded builds.
This commit is contained in:
Magne Mahre 2011-01-11 10:07:37 +01:00
parent f6bcd9c6c5
commit ebd24626ca
67 changed files with 94 additions and 816 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -17,9 +17,7 @@
#include "client_priv.h" #include "client_priv.h"
#include <signal.h> #include <signal.h>
#ifdef THREAD
#include <my_pthread.h> /* because of signal() */ #include <my_pthread.h> /* because of signal() */
#endif
#include <sys/stat.h> #include <sys/stat.h>
#include <mysql.h> #include <mysql.h>
#include <sql_common.h> #include <sql_common.h>

View File

@ -16,7 +16,7 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/cmd-line-utils) ${CMAKE_SOURCE_DIR}/cmd-line-utils)
ADD_DEFINITIONS(-DHAVE_CONFIG_H -DNO_KILL_INTR -DMYSQL_CLIENT_NO_THREADS) ADD_DEFINITIONS(-DHAVE_CONFIG_H -DNO_KILL_INTR)
INCLUDE_DIRECTORIES(${CURSES_INCLUDE_PATH}) INCLUDE_DIRECTORIES(${CURSES_INCLUDE_PATH})

View File

@ -1,4 +1,5 @@
/* Copyright (C) 2009 Sun Microsystems, Inc /* Copyright (C) 2009, 2011, Oracle and/or its affiliates. All rights
reserved
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -470,9 +471,6 @@
#cmakedefine STACK_DIRECTION @STACK_DIRECTION@ #cmakedefine STACK_DIRECTION @STACK_DIRECTION@
#define THREAD 1
#define THREAD_SAFE_CLIENT 1
#define SYSTEM_TYPE "@SYSTEM_TYPE@" #define SYSTEM_TYPE "@SYSTEM_TYPE@"
#define MACHINE_TYPE "@CMAKE_SYSTEM_PROCESSOR@" #define MACHINE_TYPE "@CMAKE_SYSTEM_PROCESSOR@"
#cmakedefine HAVE_DTRACE 1 #cmakedefine HAVE_DTRACE 1

View File

@ -319,15 +319,6 @@ static void DbugExit(const char *why);
static const char *DbugStrTok(const char *s); static const char *DbugStrTok(const char *s);
static void DbugVfprintf(FILE *stream, const char* format, va_list args); static void DbugVfprintf(FILE *stream, const char* format, va_list args);
#ifndef THREAD
/* Open profile output stream */
static FILE *OpenProfile(CODE_STATE *cs, const char *name);
/* Profile if asked for it */
static BOOLEAN DoProfile(CODE_STATE *);
/* Return current user time (ms) */
static unsigned long Clock(void);
#endif
/* /*
* Miscellaneous printf format strings. * Miscellaneous printf format strings.
*/ */
@ -355,7 +346,6 @@ static unsigned long Clock(void);
** Macros to allow dbugging with threads ** Macros to allow dbugging with threads
*/ */
#ifdef THREAD
#include <my_pthread.h> #include <my_pthread.h>
static pthread_mutex_t THR_LOCK_dbug; static pthread_mutex_t THR_LOCK_dbug;
@ -394,30 +384,6 @@ static CODE_STATE *code_state(void)
return cs; return cs;
} }
#else /* !THREAD */
static CODE_STATE static_code_state=
{
"dbug", "?func", "?file", NULL, &init_settings,
NullS, NullS, 0,0,0,0,0,NullS
};
static CODE_STATE *code_state(void)
{
if (!init_done)
{
bzero(&init_settings, sizeof(init_settings));
init_settings.out_file=stderr;
init_settings.flags=OPEN_APPEND;
init_done=TRUE;
}
return &static_code_state;
}
#define pthread_mutex_lock(A) {}
#define pthread_mutex_unlock(A) {}
#endif
/* /*
* Translate some calls among different systems. * Translate some calls among different systems.
*/ */
@ -601,15 +567,6 @@ int DbugParse(CODE_STATE *cs, const char *control)
else else
stack->flags |= PID_ON; stack->flags |= PID_ON;
break; break;
#ifndef THREAD
case 'g':
if (OpenProfile(cs, PROF_FILE))
{
stack->flags |= PROFILE_ON;
stack->p_functions= ListAdd(stack->p_functions, control, end);
}
break;
#endif
case 'L': case 'L':
if (sign < 0) if (sign < 0)
stack->flags &= ~LINE_ON; stack->flags &= ~LINE_ON;
@ -1154,23 +1111,7 @@ void _db_enter_(const char *_func_, const char *_file_,
_stack_frame_->prev= cs->framep; _stack_frame_->prev= cs->framep;
_stack_frame_->level= ++cs->level | framep_trace_flag(cs, cs->framep); _stack_frame_->level= ++cs->level | framep_trace_flag(cs, cs->framep);
cs->framep= _stack_frame_; cs->framep= _stack_frame_;
#ifndef THREAD
if (DoProfile(cs))
{
long stackused;
if (cs->framep->prev == NULL)
stackused= 0;
else
{
stackused= (char*)(cs->framep->prev) - (char*)(cs->framep);
stackused= stackused > 0 ? stackused : -stackused;
}
(void) fprintf(cs->stack->prof_file, PROF_EFMT , Clock(), cs->func);
(void) fprintf(cs->stack->prof_file, PROF_SFMT, (ulong) cs->framep, stackused,
AUTOS_REVERSE ? _stack_frame_->func : cs->func);
(void) fflush(cs->stack->prof_file);
}
#endif
switch (DoTrace(cs)) { switch (DoTrace(cs)) {
case ENABLE_TRACE: case ENABLE_TRACE:
cs->framep->level|= TRACE_ON; cs->framep->level|= TRACE_ON;
@ -1229,10 +1170,7 @@ void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_)
my_snprintf(buf, sizeof(buf), ERR_MISSING_RETURN, cs->func); my_snprintf(buf, sizeof(buf), ERR_MISSING_RETURN, cs->func);
DbugExit(buf); DbugExit(buf);
} }
#ifndef THREAD
if (DoProfile(cs))
(void) fprintf(cs->stack->prof_file, PROF_XFMT, Clock(), cs->func);
#endif
if (DoTrace(cs) & DO_TRACE) if (DoTrace(cs) & DO_TRACE)
{ {
if (TRACING) if (TRACING)
@ -1744,36 +1682,6 @@ static int DoTrace(CODE_STATE *cs)
return DONT_TRACE; return DONT_TRACE;
} }
/*
* FUNCTION
*
* DoProfile check to see if profiling is current enabled
*
* SYNOPSIS
*
* static BOOLEAN DoProfile()
*
* DESCRIPTION
*
* Checks to see if profiling is enabled based on whether the
* user has specified profiling, the maximum trace depth has
* not yet been reached, the current function is selected,
* and the current process is selected. Returns TRUE if
* profiling is enabled, FALSE otherwise.
*
*/
#ifndef THREAD
static BOOLEAN DoProfile(CODE_STATE *cs)
{
return PROFILING &&
cs->level <= cs->stack->maxdepth &&
InList(cs->stack->p_functions, cs->func) & (INCLUDE|MATCHED) &&
InList(cs->stack->processes, cs->process) & (INCLUDE|MATCHED);
}
#endif
FILE *_db_fp_(void) FILE *_db_fp_(void)
{ {
CODE_STATE *cs; CODE_STATE *cs;
@ -1900,11 +1808,7 @@ static void DoPrefix(CODE_STATE *cs, uint _line_)
cs->lineno++; cs->lineno++;
if (cs->stack->flags & PID_ON) if (cs->stack->flags & PID_ON)
{ {
#ifdef THREAD
(void) fprintf(cs->stack->out_file, "%-7s: ", my_thread_name()); (void) fprintf(cs->stack->out_file, "%-7s: ", my_thread_name());
#else
(void) fprintf(cs->stack->out_file, "%5d: ", (int) getpid());
#endif
} }
if (cs->stack->flags & NUMBER_ON) if (cs->stack->flags & NUMBER_ON)
(void) fprintf(cs->stack->out_file, "%5d: ", cs->lineno); (void) fprintf(cs->stack->out_file, "%5d: ", cs->lineno);
@ -2014,63 +1918,6 @@ static void DBUGOpenFile(CODE_STATE *cs,
} }
} }
/*
* FUNCTION
*
* OpenProfile open new output stream for profiler output
*
* SYNOPSIS
*
* static FILE *OpenProfile(name)
* char *name;
*
* DESCRIPTION
*
* Given name of a new file, opens the file
* and sets the profiler output stream to the new file.
*
* It is currently unclear whether the prefered behavior is
* to truncate any existing file, or simply append to it.
* The latter behavior would be desirable for collecting
* accumulated runtime history over a number of separate
* runs. It might take some changes to the analyzer program
* though, and the notes that Binayak sent with the profiling
* diffs indicated that append was the normal mode, but this
* does not appear to agree with the actual code. I haven't
* investigated at this time [fnf; 24-Jul-87].
*/
#ifndef THREAD
static FILE *OpenProfile(CODE_STATE *cs, const char *name)
{
REGISTER FILE *fp;
REGISTER BOOLEAN newfile;
fp=0;
if (!Writable(name))
{
(void) fprintf(cs->stack->out_file, ERR_OPEN, cs->process, name);
perror("");
(void) Delay(cs->stack->delay);
}
else
{
newfile= !EXISTS(name);
if (!(fp= fopen(name, "w")))
{
(void) fprintf(cs->stack->out_file, ERR_OPEN, cs->process, name);
perror("");
}
else
{
cs->stack->prof_file= fp;
}
}
return fp;
}
#endif
/* /*
* FUNCTION * FUNCTION
* *
@ -2419,80 +2266,6 @@ const char* _db_get_func_(void)
return cs->func; return cs->func;
} }
/*
* Here we need the definitions of the clock routine. Add your
* own for whatever system that you have.
*/
#ifndef THREAD
#if defined(HAVE_GETRUSAGE)
#include <sys/param.h>
#include <sys/resource.h>
/* extern int getrusage(int, struct rusage *); */
/*
* Returns the user time in milliseconds used by this process so
* far.
*/
static unsigned long Clock()
{
struct rusage ru;
(void) getrusage(RUSAGE_SELF, &ru);
return ru.ru_utime.tv_sec*1000 + ru.ru_utime.tv_usec/1000;
}
#elif defined(__WIN__)
static ulong Clock()
{
return clock()*(1000/CLOCKS_PER_SEC);
}
#elif defined(amiga)
struct DateStamp { /* Yes, this is a hack, but doing it right */
long ds_Days; /* is incredibly ugly without splitting this */
long ds_Minute; /* off into a separate file */
long ds_Tick;
};
static int first_clock= TRUE;
static struct DateStamp begin;
static struct DateStamp elapsed;
static unsigned long Clock()
{
register struct DateStamp *now;
register unsigned long millisec= 0;
extern VOID *AllocMem();
now= (struct DateStamp *) AllocMem((long) sizeof(struct DateStamp), 0L);
if (now != NULL)
{
if (first_clock == TRUE)
{
first_clock= FALSE;
(void) DateStamp(now);
begin= *now;
}
(void) DateStamp(now);
millisec= 24 * 3600 * (1000 / HZ) * (now->ds_Days - begin.ds_Days);
millisec += 60 * (1000 / HZ) * (now->ds_Minute - begin.ds_Minute);
millisec += (1000 / HZ) * (now->ds_Tick - begin.ds_Tick);
(void) FreeMem(now, (long) sizeof(struct DateStamp));
}
return millisec;
}
#else
static unsigned long Clock()
{
return 0;
}
#endif /* RUSAGE */
#endif /* THREADS */
#else #else

View File

@ -571,12 +571,10 @@ int main (int argc, char **argv)
FILE *infile; FILE *infile;
FILE *outfile = {stdout}; FILE *outfile = {stdout};
#ifdef THREAD
#if defined(HAVE_PTHREAD_INIT) #if defined(HAVE_PTHREAD_INIT)
pthread_init(); /* Must be called before DBUG_ENTER */ pthread_init(); /* Must be called before DBUG_ENTER */
#endif #endif
my_thread_global_init(); my_thread_global_init();
#endif /* THREAD */
{ {
DBUG_ENTER ("main"); DBUG_ENTER ("main");
DBUG_PROCESS (argv[0]); DBUG_PROCESS (argv[0]);

View File

@ -16,12 +16,11 @@ char *argv[];
{ {
register int result, ix; register int result, ix;
extern int factorial(int); extern int factorial(int);
#if defined(HAVE_PTHREAD_INIT) && defined(THREAD) #if defined(HAVE_PTHREAD_INIT)
pthread_init(); /* Must be called before DBUG_ENTER */ pthread_init(); /* Must be called before DBUG_ENTER */
#endif #endif
#ifdef THREAD
my_thread_global_init(); my_thread_global_init();
#endif
{ {
DBUG_ENTER ("main"); DBUG_ENTER ("main");
DBUG_PROCESS (argv[0]); DBUG_PROCESS (argv[0]);

View File

@ -44,12 +44,11 @@ int main (int argc, char *argv[])
if (argc == 1) if (argc == 1)
return 0; return 0;
#if defined(HAVE_PTHREAD_INIT) && defined(THREAD) #if defined(HAVE_PTHREAD_INIT)
pthread_init(); /* Must be called before DBUG_ENTER */ pthread_init(); /* Must be called before DBUG_ENTER */
#endif #endif
#ifdef THREAD
my_thread_global_init(); my_thread_global_init();
#endif
dup2(1, 2); dup2(1, 2);
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
{ {

View File

@ -40,7 +40,6 @@ SET(HEADERS
my_xml.h my_xml.h
mysql_embed.h mysql_embed.h
my_pthread.h my_pthread.h
my_no_pthread.h
decimal.h decimal.h
errmsg.h errmsg.h
my_global.h my_global.h

View File

@ -1,4 +1,5 @@
/* Copyright (C) 2000-2004 MySQL AB, 2009 Sun Microsystems, Inc /* Copyright (C) 2000, 2011, Oracle and/or its affiliates. All rights
reserved
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -25,10 +26,9 @@ extern "C" {
#ifndef _my_base_h #ifndef _my_base_h
#include <my_base.h> #include <my_base.h>
#endif #endif
#ifdef THREAD
#include <my_pthread.h> #include <my_pthread.h>
#include <thr_lock.h> #include <thr_lock.h>
#endif
#include "my_handler.h" #include "my_handler.h"
#include "my_tree.h" #include "my_tree.h"
@ -146,10 +146,8 @@ typedef struct st_heap_share
uint open_count; uint open_count;
uchar *del_link; /* Link to next block with del. rec */ uchar *del_link; /* Link to next block with del. rec */
char * name; /* Name of "memory-file" */ char * name; /* Name of "memory-file" */
#ifdef THREAD
THR_LOCK lock; THR_LOCK lock;
mysql_mutex_t intern_lock; /* Locking for use with _locking */ mysql_mutex_t intern_lock; /* Locking for use with _locking */
#endif
my_bool delete_on_close; my_bool delete_on_close;
LIST open_list; LIST open_list;
uint auto_key; uint auto_key;
@ -175,9 +173,7 @@ typedef struct st_heap_info
TREE_ELEMENT **last_pos; TREE_ELEMENT **last_pos;
uint lastkey_len; uint lastkey_len;
my_bool implicit_emptied; my_bool implicit_emptied;
#ifdef THREAD
THR_LOCK_DATA lock; THR_LOCK_DATA lock;
#endif
LIST open_list; LIST open_list;
} HP_INFO; } HP_INFO;

View File

@ -1,4 +1,5 @@
/* Copyright (C) 2000 MySQL AB /* Copyright (C) 2000, 2011, Oracle and/or its affiliates. All rights
reserved
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -30,9 +31,6 @@
#define EOVERFLOW 84 #define EOVERFLOW 84
#endif #endif
#if !defined(USE_MY_FUNC) && !defined(THREAD)
#include <my_nosys.h> /* For faster code, after test */
#endif /* USE_MY_FUNC */
#endif /* stdin */ #endif /* stdin */
#include <my_list.h> #include <my_list.h>

View File

@ -33,9 +33,7 @@ typedef struct st_bitmap
thread_safe flag in bitmap_init was set. Otherwise, we optimize by not thread_safe flag in bitmap_init was set. Otherwise, we optimize by not
acquiring the mutex acquiring the mutex
*/ */
#ifdef THREAD
mysql_mutex_t *mutex; mysql_mutex_t *mutex;
#endif
} MY_BITMAP; } MY_BITMAP;
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -212,13 +212,6 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
/* The client defines this to avoid all thread code */
#if defined(MYSQL_CLIENT_NO_THREADS) || defined(UNDEF_THREADS_HACK)
#undef THREAD
#undef HAVE_LINUXTHREADS
#undef HAVE_NPTL
#endif
#ifdef HAVE_THREADS_WITHOUT_SOCKETS #ifdef HAVE_THREADS_WITHOUT_SOCKETS
/* MIT pthreads does not work with unix sockets */ /* MIT pthreads does not work with unix sockets */
#undef HAVE_SYS_UN_H #undef HAVE_SYS_UN_H
@ -261,7 +254,7 @@
#endif #endif
#endif #endif
#if defined(THREAD) && !defined(__WIN__) #if !defined(__WIN__)
#ifndef _POSIX_PTHREAD_SEMANTICS #ifndef _POSIX_PTHREAD_SEMANTICS
#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */ #define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */
#endif #endif
@ -282,7 +275,7 @@ C_MODE_END
#if !defined(SCO) && !defined(_REENTRANT) #if !defined(SCO) && !defined(_REENTRANT)
#define _REENTRANT 1 /* Threads requires reentrant code */ #define _REENTRANT 1 /* Threads requires reentrant code */
#endif #endif
#endif /* THREAD */ #endif /* !defined(__WIN__) */
/* Go around some bugs in different OS and compilers */ /* Go around some bugs in different OS and compilers */
#ifdef _AIX /* By soren@t.dk */ #ifdef _AIX /* By soren@t.dk */
@ -415,7 +408,7 @@ C_MODE_END
#include <sys/stream.h> /* HPUX 10.20 defines ulong here. UGLY !!! */ #include <sys/stream.h> /* HPUX 10.20 defines ulong here. UGLY !!! */
#define HAVE_ULONG #define HAVE_ULONG
#endif #endif
#if defined(HPUX10) && defined(_LARGEFILE64_SOURCE) && defined(THREAD) #if defined(HPUX10) && defined(_LARGEFILE64_SOURCE)
/* Fix bug in setrlimit */ /* Fix bug in setrlimit */
#undef setrlimit #undef setrlimit
#define setrlimit cma_setrlimit64 #define setrlimit cma_setrlimit64
@ -1342,17 +1335,6 @@ do { doubleget_union _tmp; \
#endif /* WORDS_BIGENDIAN */ #endif /* WORDS_BIGENDIAN */
#ifndef THREAD
#define thread_safe_increment(V,L) (V)++
#define thread_safe_decrement(V,L) (V)--
#define thread_safe_add(V,C,L) (V)+=(C)
#define thread_safe_sub(V,C,L) (V)-=(C)
#define statistic_increment(V,L) (V)++
#define statistic_decrement(V,L) (V)--
#define statistic_add(V,C,L) (V)+=(C)
#define statistic_sub(V,C,L) (V)-=(C)
#endif
#ifdef HAVE_CHARSET_utf8 #ifdef HAVE_CHARSET_utf8
#define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8" #define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8"
#else #else

View File

@ -1,72 +0,0 @@
#ifndef MY_NO_PTHREAD_INCLUDED
#define MY_NO_PTHREAD_INCLUDED
/* Copyright (C) 2000 MySQL AB, 2008-2009 Sun Microsystems, Inc
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef THREAD
/*
This block is to access some thread-related type definitions
even in builds which do not need thread functions,
as some variables (based on these types) are declared
even in non-threaded builds.
Case in point: 'mf_keycache.c'
*/
#if defined(__WIN__)
#else /* Normal threads */
#include <pthread.h>
#endif /* defined(__WIN__) */
/*
This undefs some pthread mutex locks when one isn't using threads
to make thread safe code, that should also work in single thread
environment, easier to use.
*/
#define pthread_mutex_init(A,B)
#define pthread_mutex_lock(A)
#define pthread_mutex_unlock(A)
#define pthread_mutex_destroy(A)
#define my_rwlock_init(A,B)
#define rw_rdlock(A)
#define rw_wrlock(A)
#define rw_unlock(A)
#define rwlock_destroy(A)
#define safe_mutex_assert_owner(mp)
#define mysql_mutex_init(A, B, C) do {} while (0)
#define mysql_mutex_lock(A) do {} while (0)
#define mysql_mutex_unlock(A) do {} while (0)
#define mysql_mutex_destroy(A) do {} while (0)
#define mysql_rwlock_init(A, B, C) do {} while (0)
#define mysql_rwlock_rdlock(A) do {} while (0)
#define mysql_rwlock_wrlock(A) do {} while (0)
#define mysql_rwlock_unlock(A) do {} while (0)
#define mysql_rwlock_destroy(A) do {} while (0)
typedef int my_pthread_once_t;
#define MY_PTHREAD_ONCE_INIT 0
#define MY_PTHREAD_ONCE_DONE 1
#define my_pthread_once(C,F) do { \
if (*(C) != MY_PTHREAD_ONCE_DONE) { F(); *(C)= MY_PTHREAD_ONCE_DONE; } \
} while(0)
#endif
#endif /* MY_NO_PTHREAD_INCLUDED */

View File

@ -881,12 +881,6 @@ extern uint thd_lib_detected;
to use my_atomic operations instead. to use my_atomic operations instead.
*/ */
/*
Warning:
When compiling without threads, this file is not included.
See the *other* declarations of thread_safe_xxx in include/my_global.h
*/
#ifdef THREAD
#ifndef thread_safe_increment #ifndef thread_safe_increment
#ifdef _WIN32 #ifdef _WIN32
#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V)) #define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
@ -910,7 +904,7 @@ extern uint thd_lib_detected;
(mysql_mutex_lock((L)), (V)-=(C), mysql_mutex_unlock((L))) (mysql_mutex_lock((L)), (V)-=(C), mysql_mutex_unlock((L)))
#endif #endif
#endif #endif
#endif
/* /*
statistics_xxx functions are for non critical statistic, statistics_xxx functions are for non critical statistic,

View File

@ -41,11 +41,7 @@ typedef struct my_aio_result {
# define MEM_CHECK_DEFINED(a,len) ((void) 0) # define MEM_CHECK_DEFINED(a,len) ((void) 0)
#endif /* HAVE_VALGRIND */ #endif /* HAVE_VALGRIND */
#ifndef THREAD
extern int my_errno; /* Last error in mysys */
#else
#include <my_pthread.h> #include <my_pthread.h>
#endif
#include <m_ctype.h> /* for CHARSET_INFO */ #include <m_ctype.h> /* for CHARSET_INFO */
#include <stdarg.h> #include <stdarg.h>
@ -314,7 +310,7 @@ struct st_my_file_info
int oflag; /* open flags, e.g O_APPEND */ int oflag; /* open flags, e.g O_APPEND */
#endif #endif
enum file_type type; enum file_type type;
#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32) #if !defined(HAVE_PREAD) && !defined(_WIN32)
mysql_mutex_t mutex; mysql_mutex_t mutex;
#endif #endif
}; };
@ -334,9 +330,7 @@ typedef struct st_my_tmpdir
DYNAMIC_ARRAY full_list; DYNAMIC_ARRAY full_list;
char **list; char **list;
uint cur, max; uint cur, max;
#ifdef THREAD
mysql_mutex_t mutex; mysql_mutex_t mutex;
#endif
} MY_TMPDIR; } MY_TMPDIR;
typedef struct st_dynamic_string typedef struct st_dynamic_string
@ -348,7 +342,6 @@ typedef struct st_dynamic_string
struct st_io_cache; struct st_io_cache;
typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*); typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*);
#ifdef THREAD
typedef struct st_io_cache_share typedef struct st_io_cache_share
{ {
mysql_mutex_t mutex; /* To sync on reads into buffer. */ mysql_mutex_t mutex; /* To sync on reads into buffer. */
@ -368,7 +361,6 @@ typedef struct st_io_cache_share
my_bool alloced; my_bool alloced;
#endif #endif
} IO_CACHE_SHARE; } IO_CACHE_SHARE;
#endif
typedef struct st_io_cache /* Used when cacheing files */ typedef struct st_io_cache /* Used when cacheing files */
{ {
@ -409,7 +401,7 @@ typedef struct st_io_cache /* Used when cacheing files */
WRITE_CACHE, and &read_pos and &read_end respectively otherwise WRITE_CACHE, and &read_pos and &read_end respectively otherwise
*/ */
uchar **current_pos, **current_end; uchar **current_pos, **current_end;
#ifdef THREAD
/* /*
The lock is for append buffer used in SEQ_READ_APPEND cache The lock is for append buffer used in SEQ_READ_APPEND cache
need mutex copying from append buffer to read buffer. need mutex copying from append buffer to read buffer.
@ -423,7 +415,7 @@ typedef struct st_io_cache /* Used when cacheing files */
READ_CACHE mode is supported. READ_CACHE mode is supported.
*/ */
IO_CACHE_SHARE *share; IO_CACHE_SHARE *share;
#endif
/* /*
A caller will use my_b_read() macro to read from the cache A caller will use my_b_read() macro to read from the cache
if the data is already in cache, it will be simply copied with if the data is already in cache, it will be simply copied with
@ -656,14 +648,6 @@ extern int my_redel(const char *from, const char *to, int MyFlags);
extern int my_copystat(const char *from, const char *to, int MyFlags); extern int my_copystat(const char *from, const char *to, int MyFlags);
extern char * my_filename(File fd); extern char * my_filename(File fd);
#ifndef THREAD
extern void dont_break(void);
extern void allow_break(void);
#else
#define dont_break()
#define allow_break()
#endif
#ifdef EXTRA_DEBUG #ifdef EXTRA_DEBUG
void my_print_open_files(void); void my_print_open_files(void);
#else #else
@ -736,12 +720,10 @@ extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type,
pbool clear_cache); pbool clear_cache);
extern void setup_io_cache(IO_CACHE* info); extern void setup_io_cache(IO_CACHE* info);
extern int _my_b_read(IO_CACHE *info,uchar *Buffer,size_t Count); extern int _my_b_read(IO_CACHE *info,uchar *Buffer,size_t Count);
#ifdef THREAD
extern int _my_b_read_r(IO_CACHE *info,uchar *Buffer,size_t Count); extern int _my_b_read_r(IO_CACHE *info,uchar *Buffer,size_t Count);
extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare, extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare,
IO_CACHE *write_cache, uint num_threads); IO_CACHE *write_cache, uint num_threads);
extern void remove_io_thread(IO_CACHE *info); extern void remove_io_thread(IO_CACHE *info);
#endif
extern int _my_b_seq_read(IO_CACHE *info,uchar *Buffer,size_t Count); extern int _my_b_seq_read(IO_CACHE *info,uchar *Buffer,size_t Count);
extern int _my_b_net_read(IO_CACHE *info,uchar *Buffer,size_t Count); extern int _my_b_net_read(IO_CACHE *info,uchar *Buffer,size_t Count);
extern int _my_b_get(IO_CACHE *info); extern int _my_b_get(IO_CACHE *info);

View File

@ -433,10 +433,8 @@ typedef struct st_mi_check_param
const char *db_name, *table_name; const char *db_name, *table_name;
const char *op_name; const char *op_name;
enum_mi_stats_method stats_method; enum_mi_stats_method stats_method;
#ifdef THREAD
mysql_mutex_t print_msg_mutex; mysql_mutex_t print_msg_mutex;
my_bool need_print_msg_lock; my_bool need_print_msg_lock;
#endif
} MI_CHECK; } MI_CHECK;
typedef struct st_sort_ft_buf typedef struct st_sort_ft_buf
@ -460,10 +458,8 @@ typedef struct st_sort_info
SORT_FT_BUF *ft_buf; SORT_FT_BUF *ft_buf;
/* sync things */ /* sync things */
uint got_error, threads_running; uint got_error, threads_running;
#ifdef THREAD
mysql_mutex_t mutex; mysql_mutex_t mutex;
mysql_cond_t cond; mysql_cond_t cond;
#endif
} SORT_INFO; } SORT_INFO;
/* functions in mi_check */ /* functions in mi_check */

View File

@ -41,7 +41,7 @@ typedef struct st_alarm_info
void thr_alarm_info(ALARM_INFO *info); void thr_alarm_info(ALARM_INFO *info);
#if defined(DONT_USE_THR_ALARM) || !defined(THREAD) #if defined(DONT_USE_THR_ALARM)
#define USE_ALARM_THREAD #define USE_ALARM_THREAD
#undef USE_ONE_SIGNAL_HAND #undef USE_ONE_SIGNAL_HAND

View File

@ -35,21 +35,6 @@ sig_handler my_pipe_sig_handler(int sig);
void read_user_name(char *name); void read_user_name(char *name);
my_bool handle_local_infile(MYSQL *mysql, const char *net_filename); my_bool handle_local_infile(MYSQL *mysql, const char *net_filename);
/*
Let the user specify that we don't want SIGPIPE; This doesn't however work
with threaded applications as we can have multiple read in progress.
*/
#if !defined(__WIN__) && defined(SIGPIPE) && !defined(THREAD)
#define init_sigpipe_variables sig_return old_signal_handler=(sig_return) 0;
#define set_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) old_signal_handler=signal(SIGPIPE, my_pipe_sig_handler)
#define reset_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) signal(SIGPIPE,old_signal_handler);
#else
#define init_sigpipe_variables
#define set_sigpipe(mysql)
#define reset_sigpipe(mysql)
#endif
void mysql_read_default_options(struct st_mysql_options *options, void mysql_read_default_options(struct st_mysql_options *options,
const char *filename,const char *group); const char *filename,const char *group);
void mysql_detach_stmt_list(LIST **stmt_list, const char *func_name); void mysql_detach_stmt_list(LIST **stmt_list, const char *func_name);

View File

@ -51,7 +51,7 @@
#ifdef HAVE_SYS_UN_H #ifdef HAVE_SYS_UN_H
#include <sys/un.h> #include <sys/un.h>
#endif #endif
#if defined(THREAD) && !defined(__WIN__) #if !defined(__WIN__)
#include <my_pthread.h> /* because of signal() */ #include <my_pthread.h> /* because of signal() */
#endif #endif
#ifndef INADDR_NONE #ifndef INADDR_NONE
@ -172,10 +172,8 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
result= init_embedded_server(argc, argv, groups); result= init_embedded_server(argc, argv, groups);
#endif #endif
} }
#ifdef THREAD
else else
result= (int)my_thread_init(); /* Init if new thread */ result= (int)my_thread_init(); /* Init if new thread */
#endif
return result; return result;
} }
@ -229,18 +227,12 @@ MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void)
my_bool STDCALL mysql_thread_init() my_bool STDCALL mysql_thread_init()
{ {
#ifdef THREAD
return my_thread_init(); return my_thread_init();
#else
return 0;
#endif
} }
void STDCALL mysql_thread_end() void STDCALL mysql_thread_end()
{ {
#ifdef THREAD
my_thread_end(); my_thread_end();
#endif
} }
@ -1092,11 +1084,7 @@ void STDCALL mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *csinfo)
uint STDCALL mysql_thread_safe(void) uint STDCALL mysql_thread_safe(void)
{ {
#ifdef THREAD
return 1; return 1;
#else
return 0;
#endif
} }

View File

@ -1,72 +0,0 @@
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Dont let the user break when you are doing something important */
/* Remembers if it got 'SIGINT' and executes it on allow_break */
/* A static buffer is used; don't call dont_break() twice in a row */
#include "mysys_priv.h"
#include "my_static.h"
/* Set variable that we can't break */
#if !defined(THREAD)
void dont_break(void)
{
my_dont_interrupt=1;
return;
} /* dont_break */
void allow_break(void)
{
{
reg1 int index;
my_dont_interrupt=0;
if (_my_signals)
{
if (_my_signals > MAX_SIGNALS)
_my_signals=MAX_SIGNALS;
for (index=0 ; index < _my_signals ; index++)
{
if (_my_sig_remember[index].func) /* Safequard */
{
(*_my_sig_remember[index].func)(_my_sig_remember[index].number);
_my_sig_remember[index].func=0;
}
}
_my_signals=0;
}
}
} /* dont_break */
#endif
/* Set old status */
#if !defined(THREAD)
void my_remember_signal(int signal_number, sig_handler (*func) (int))
{
#ifndef __WIN__
reg1 int index;
index=_my_signals++; /* Nobody can break a ++ ? */
if (index < MAX_SIGNALS)
{
_my_sig_remember[index].number=signal_number;
_my_sig_remember[index].func=func;
}
#endif /* __WIN__ */
} /* my_remember_signal */
#endif /* THREAD */

View File

@ -55,15 +55,10 @@ static void my_aiowait(my_aio_result *result);
#endif #endif
#include <errno.h> #include <errno.h>
#ifdef THREAD
#define lock_append_buffer(info) \ #define lock_append_buffer(info) \
mysql_mutex_lock(&(info)->append_buffer_lock) mysql_mutex_lock(&(info)->append_buffer_lock)
#define unlock_append_buffer(info) \ #define unlock_append_buffer(info) \
mysql_mutex_unlock(&(info)->append_buffer_lock) mysql_mutex_unlock(&(info)->append_buffer_lock)
#else
#define lock_append_buffer(info)
#define unlock_append_buffer(info)
#endif
#define IO_ROUND_UP(X) (((X)+IO_SIZE-1) & ~(IO_SIZE-1)) #define IO_ROUND_UP(X) (((X)+IO_SIZE-1) & ~(IO_SIZE-1))
#define IO_ROUND_DN(X) ( (X) & ~(IO_SIZE-1)) #define IO_ROUND_DN(X) ( (X) & ~(IO_SIZE-1))
@ -116,11 +111,7 @@ init_functions(IO_CACHE* info)
info->write_function = 0; /* Force a core if used */ info->write_function = 0; /* Force a core if used */
break; break;
default: default:
info->read_function = info->read_function = info->share ? _my_b_read_r : _my_b_read;
#ifdef THREAD
info->share ? _my_b_read_r :
#endif
_my_b_read;
info->write_function = _my_b_write; info->write_function = _my_b_write;
} }
@ -193,9 +184,7 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
} }
info->disk_writes= 0; info->disk_writes= 0;
#ifdef THREAD
info->share=0; info->share=0;
#endif
if (!cachesize && !(cachesize= my_default_record_cache_size)) if (!cachesize && !(cachesize= my_default_record_cache_size))
DBUG_RETURN(1); /* No cache requested */ DBUG_RETURN(1); /* No cache requested */
@ -263,12 +252,10 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
{ {
info->append_read_pos = info->write_pos = info->write_buffer; info->append_read_pos = info->write_pos = info->write_buffer;
info->write_end = info->write_buffer + info->buffer_length; info->write_end = info->write_buffer + info->buffer_length;
#ifdef THREAD
mysql_mutex_init(key_IO_CACHE_append_buffer_lock, mysql_mutex_init(key_IO_CACHE_append_buffer_lock,
&info->append_buffer_lock, MY_MUTEX_INIT_FAST); &info->append_buffer_lock, MY_MUTEX_INIT_FAST);
#endif
} }
#if defined(SAFE_MUTEX) && defined(THREAD) #if defined(SAFE_MUTEX)
else else
{ {
/* Clear mutex so that safe_mutex will notice that it's not initialized */ /* Clear mutex so that safe_mutex will notice that it's not initialized */
@ -601,7 +588,6 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
} }
#ifdef THREAD
/* /*
Prepare IO_CACHE for shared use. Prepare IO_CACHE for shared use.
@ -1162,7 +1148,6 @@ static void copy_to_read_buffer(IO_CACHE *write_cache,
write_length-= copy_length; write_length-= copy_length;
} }
} }
#endif /*THREAD*/
/* /*
@ -1579,7 +1564,6 @@ int _my_b_write(register IO_CACHE *info, const uchar *Buffer, size_t Count)
if (mysql_file_write(info->file, Buffer, length, info->myflags | MY_NABP)) if (mysql_file_write(info->file, Buffer, length, info->myflags | MY_NABP))
return info->error= -1; return info->error= -1;
#ifdef THREAD
/* /*
In case of a shared I/O cache with a writer we normally do direct In case of a shared I/O cache with a writer we normally do direct
write cache to read cache copy. Simulate this here by direct write cache to read cache copy. Simulate this here by direct
@ -1593,7 +1577,6 @@ int _my_b_write(register IO_CACHE *info, const uchar *Buffer, size_t Count)
*/ */
if (info->share) if (info->share)
copy_to_read_buffer(info, Buffer, length); copy_to_read_buffer(info, Buffer, length);
#endif
Count-=length; Count-=length;
Buffer+=length; Buffer+=length;
@ -1615,13 +1598,11 @@ int my_b_append(register IO_CACHE *info, const uchar *Buffer, size_t Count)
{ {
size_t rest_length,length; size_t rest_length,length;
#ifdef THREAD
/* /*
Assert that we cannot come here with a shared cache. If we do one Assert that we cannot come here with a shared cache. If we do one
day, we might need to add a call to copy_to_read_buffer(). day, we might need to add a call to copy_to_read_buffer().
*/ */
DBUG_ASSERT(!info->share); DBUG_ASSERT(!info->share);
#endif
lock_append_buffer(info); lock_append_buffer(info);
rest_length= (size_t) (info->write_end - info->write_pos); rest_length= (size_t) (info->write_end - info->write_pos);
@ -1683,13 +1664,11 @@ int my_block_write(register IO_CACHE *info, const uchar *Buffer, size_t Count,
size_t length; size_t length;
int error=0; int error=0;
#ifdef THREAD
/* /*
Assert that we cannot come here with a shared cache. If we do one Assert that we cannot come here with a shared cache. If we do one
day, we might need to add a call to copy_to_read_buffer(). day, we might need to add a call to copy_to_read_buffer().
*/ */
DBUG_ASSERT(!info->share); DBUG_ASSERT(!info->share);
#endif
if (pos < info->pos_in_file) if (pos < info->pos_in_file)
{ {
@ -1735,16 +1714,10 @@ int my_block_write(register IO_CACHE *info, const uchar *Buffer, size_t Count,
/* Flush write cache */ /* Flush write cache */
#ifdef THREAD
#define LOCK_APPEND_BUFFER if (need_append_buffer_lock) \ #define LOCK_APPEND_BUFFER if (need_append_buffer_lock) \
lock_append_buffer(info); lock_append_buffer(info);
#define UNLOCK_APPEND_BUFFER if (need_append_buffer_lock) \ #define UNLOCK_APPEND_BUFFER if (need_append_buffer_lock) \
unlock_append_buffer(info); unlock_append_buffer(info);
#else
#define LOCK_APPEND_BUFFER
#define UNLOCK_APPEND_BUFFER
#endif
int my_b_flush_io_cache(IO_CACHE *info, int my_b_flush_io_cache(IO_CACHE *info,
int need_append_buffer_lock __attribute__((unused))) int need_append_buffer_lock __attribute__((unused)))
@ -1755,10 +1728,8 @@ int my_b_flush_io_cache(IO_CACHE *info,
DBUG_ENTER("my_b_flush_io_cache"); DBUG_ENTER("my_b_flush_io_cache");
DBUG_PRINT("enter", ("cache: 0x%lx", (long) info)); DBUG_PRINT("enter", ("cache: 0x%lx", (long) info));
#ifdef THREAD
if (!append_cache) if (!append_cache)
need_append_buffer_lock= 0; need_append_buffer_lock= 0;
#endif
if (info->type == WRITE_CACHE || append_cache) if (info->type == WRITE_CACHE || append_cache)
{ {
@ -1771,7 +1742,6 @@ int my_b_flush_io_cache(IO_CACHE *info,
if ((length=(size_t) (info->write_pos - info->write_buffer))) if ((length=(size_t) (info->write_pos - info->write_buffer)))
{ {
#ifdef THREAD
/* /*
In case of a shared I/O cache with a writer we do direct write In case of a shared I/O cache with a writer we do direct write
cache to read cache copy. Do it before the write here so that cache to read cache copy. Do it before the write here so that
@ -1780,7 +1750,6 @@ int my_b_flush_io_cache(IO_CACHE *info,
*/ */
if (info->share) if (info->share)
copy_to_read_buffer(info, info->write_buffer, length); copy_to_read_buffer(info, info->write_buffer, length);
#endif
pos_in_file=info->pos_in_file; pos_in_file=info->pos_in_file;
/* /*
@ -1859,13 +1828,11 @@ int end_io_cache(IO_CACHE *info)
DBUG_ENTER("end_io_cache"); DBUG_ENTER("end_io_cache");
DBUG_PRINT("enter",("cache: 0x%lx", (ulong) info)); DBUG_PRINT("enter",("cache: 0x%lx", (ulong) info));
#ifdef THREAD
/* /*
Every thread must call remove_io_thread(). The last one destroys Every thread must call remove_io_thread(). The last one destroys
the share elements. the share elements.
*/ */
DBUG_ASSERT(!info->share || !info->share->total_threads); DBUG_ASSERT(!info->share || !info->share->total_threads);
#endif
if ((pre_close=info->pre_close)) if ((pre_close=info->pre_close))
{ {
@ -1884,9 +1851,7 @@ int end_io_cache(IO_CACHE *info)
{ {
/* Destroy allocated mutex */ /* Destroy allocated mutex */
info->type= TYPE_NOT_SET; info->type= TYPE_NOT_SET;
#ifdef THREAD
mysql_mutex_destroy(&info->append_buffer_lock); mysql_mutex_destroy(&info->append_buffer_lock);
#endif
} }
DBUG_RETURN(error); DBUG_RETURN(error);
} /* end_io_cache */ } /* end_io_cache */

View File

@ -90,9 +90,8 @@ my_off_t my_b_append_tell(IO_CACHE* info)
from messing with the variables that we need in order to provide the from messing with the variables that we need in order to provide the
answer to the question. answer to the question.
*/ */
#ifdef THREAD
mysql_mutex_lock(&info->append_buffer_lock); mysql_mutex_lock(&info->append_buffer_lock);
#endif
#ifndef DBUG_OFF #ifndef DBUG_OFF
/* /*
Make sure EOF is where we think it is. Note that we cannot just use Make sure EOF is where we think it is. Note that we cannot just use
@ -112,9 +111,7 @@ my_off_t my_b_append_tell(IO_CACHE* info)
} }
#endif #endif
res = info->end_of_file + (info->write_pos-info->append_read_pos); res = info->end_of_file + (info->write_pos-info->append_read_pos);
#ifdef THREAD
mysql_mutex_unlock(&info->append_buffer_lock); mysql_mutex_unlock(&info->append_buffer_lock);
#endif
return res; return res;
} }

View File

@ -225,14 +225,11 @@ KEY_CACHE *dflt_key_cache= &dflt_key_cache_var;
#define FLUSH_CACHE 2000 /* sort this many blocks at once */ #define FLUSH_CACHE 2000 /* sort this many blocks at once */
static int flush_all_key_blocks(KEY_CACHE *keycache); static int flush_all_key_blocks(KEY_CACHE *keycache);
#ifdef THREAD
static void wait_on_queue(KEYCACHE_WQUEUE *wqueue, static void wait_on_queue(KEYCACHE_WQUEUE *wqueue,
mysql_mutex_t *mutex); mysql_mutex_t *mutex);
static void release_whole_queue(KEYCACHE_WQUEUE *wqueue); static void release_whole_queue(KEYCACHE_WQUEUE *wqueue);
#else
#define wait_on_queue(wqueue, mutex) do {} while (0)
#define release_whole_queue(wqueue) do {} while (0)
#endif
static void free_block(KEY_CACHE *keycache, BLOCK_LINK *block); static void free_block(KEY_CACHE *keycache, BLOCK_LINK *block);
#if !defined(DBUG_OFF) #if !defined(DBUG_OFF)
static void test_key_cache(KEY_CACHE *keycache, static void test_key_cache(KEY_CACHE *keycache,
@ -285,7 +282,7 @@ static void keycache_debug_print(const char *fmt,...);
#endif /* defined(KEYCACHE_DEBUG_LOG) && defined(KEYCACHE_DEBUG) */ #endif /* defined(KEYCACHE_DEBUG_LOG) && defined(KEYCACHE_DEBUG) */
#if defined(KEYCACHE_DEBUG) || !defined(DBUG_OFF) #if defined(KEYCACHE_DEBUG) || !defined(DBUG_OFF)
#ifdef THREAD
static long keycache_thread_id; static long keycache_thread_id;
#define KEYCACHE_THREAD_TRACE(l) \ #define KEYCACHE_THREAD_TRACE(l) \
KEYCACHE_DBUG_PRINT(l,("|thread %ld",keycache_thread_id)) KEYCACHE_DBUG_PRINT(l,("|thread %ld",keycache_thread_id))
@ -297,11 +294,6 @@ static long keycache_thread_id;
#define KEYCACHE_THREAD_TRACE_END(l) \ #define KEYCACHE_THREAD_TRACE_END(l) \
KEYCACHE_DBUG_PRINT(l,("]thread %ld",keycache_thread_id)) KEYCACHE_DBUG_PRINT(l,("]thread %ld",keycache_thread_id))
#else /* THREAD */
#define KEYCACHE_THREAD_TRACE(l) KEYCACHE_DBUG_PRINT(l,(""))
#define KEYCACHE_THREAD_TRACE_BEGIN(l) KEYCACHE_DBUG_PRINT(l,(""))
#define KEYCACHE_THREAD_TRACE_END(l) KEYCACHE_DBUG_PRINT(l,(""))
#endif /* THREAD */
#else #else
#define KEYCACHE_THREAD_TRACE_BEGIN(l) #define KEYCACHE_THREAD_TRACE_BEGIN(l)
#define KEYCACHE_THREAD_TRACE_END(l) #define KEYCACHE_THREAD_TRACE_END(l)
@ -583,7 +575,6 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
keycache_pthread_mutex_lock(&keycache->cache_lock); keycache_pthread_mutex_lock(&keycache->cache_lock);
#ifdef THREAD
/* /*
We may need to wait for another thread which is doing a resize We may need to wait for another thread which is doing a resize
already. This cannot happen in the MySQL server though. It allows already. This cannot happen in the MySQL server though. It allows
@ -596,7 +587,6 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
wait_on_queue(&keycache->resize_queue, &keycache->cache_lock); wait_on_queue(&keycache->resize_queue, &keycache->cache_lock);
/* purecov: end */ /* purecov: end */
} }
#endif
/* /*
Mark the operation in progress. This blocks other threads from doing Mark the operation in progress. This blocks other threads from doing
@ -625,7 +615,6 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
keycache->resize_in_flush= 0; keycache->resize_in_flush= 0;
} }
#ifdef THREAD
/* /*
Some direct read/write operations (bypassing the cache) may still be Some direct read/write operations (bypassing the cache) may still be
unfinished. Wait until they are done. If the key cache can be used, unfinished. Wait until they are done. If the key cache can be used,
@ -639,9 +628,6 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
*/ */
while (keycache->cnt_for_resize_op) while (keycache->cnt_for_resize_op)
wait_on_queue(&keycache->waiting_for_resize_cnt, &keycache->cache_lock); wait_on_queue(&keycache->waiting_for_resize_cnt, &keycache->cache_lock);
#else
KEYCACHE_DBUG_ASSERT(keycache->cnt_for_resize_op == 0);
#endif
/* /*
Free old cache structures, allocate new structures, and initialize Free old cache structures, allocate new structures, and initialize
@ -782,8 +768,6 @@ void end_key_cache(KEY_CACHE *keycache, my_bool cleanup)
} /* end_key_cache */ } /* end_key_cache */
#ifdef THREAD
/* /*
Link a thread into double-linked queue of waiting threads. Link a thread into double-linked queue of waiting threads.
@ -963,8 +947,6 @@ static void release_whole_queue(KEYCACHE_WQUEUE *wqueue)
wqueue->last_thread= NULL; wqueue->last_thread= NULL;
} }
#endif /* THREAD */
/* /*
Unlink a block from the chain of dirty/clean blocks Unlink a block from the chain of dirty/clean blocks
@ -1136,7 +1118,7 @@ static void link_block(KEY_CACHE *keycache, BLOCK_LINK *block, my_bool hot,
DBUG_ASSERT(block->prev_changed && *block->prev_changed == block); DBUG_ASSERT(block->prev_changed && *block->prev_changed == block);
DBUG_ASSERT(!block->next_used); DBUG_ASSERT(!block->next_used);
DBUG_ASSERT(!block->prev_used); DBUG_ASSERT(!block->prev_used);
#ifdef THREAD
if (!hot && keycache->waiting_for_block.last_thread) if (!hot && keycache->waiting_for_block.last_thread)
{ {
/* Signal that in the LRU warm sub-chain an available block has appeared */ /* Signal that in the LRU warm sub-chain an available block has appeared */
@ -1196,10 +1178,7 @@ static void link_block(KEY_CACHE *keycache, BLOCK_LINK *block, my_bool hot,
#endif #endif
return; return;
} }
#else /* THREAD */
KEYCACHE_DBUG_ASSERT(! (!hot && keycache->waiting_for_block.last_thread));
/* Condition not transformed using DeMorgan, to keep the text identical */
#endif /* THREAD */
pins= hot ? &keycache->used_ins : &keycache->used_last; pins= hot ? &keycache->used_ins : &keycache->used_last;
ins= *pins; ins= *pins;
if (ins) if (ins)
@ -1421,12 +1400,9 @@ static void remove_reader(BLOCK_LINK *block)
DBUG_ASSERT(!block->next_used); DBUG_ASSERT(!block->next_used);
DBUG_ASSERT(!block->prev_used); DBUG_ASSERT(!block->prev_used);
DBUG_ASSERT(block->hash_link->requests); DBUG_ASSERT(block->hash_link->requests);
#ifdef THREAD
if (! --block->hash_link->requests && block->condvar) if (! --block->hash_link->requests && block->condvar)
keycache_pthread_cond_signal(block->condvar); keycache_pthread_cond_signal(block->condvar);
#else
--block->hash_link->requests;
#endif
} }
@ -1438,7 +1414,6 @@ static void remove_reader(BLOCK_LINK *block)
static void wait_for_readers(KEY_CACHE *keycache, static void wait_for_readers(KEY_CACHE *keycache,
BLOCK_LINK *block) BLOCK_LINK *block)
{ {
#ifdef THREAD
struct st_my_thread_var *thread= my_thread_var; struct st_my_thread_var *thread= my_thread_var;
DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE)); DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE));
DBUG_ASSERT(!(block->status & (BLOCK_IN_FLUSH | BLOCK_CHANGED))); DBUG_ASSERT(!(block->status & (BLOCK_IN_FLUSH | BLOCK_CHANGED)));
@ -1460,9 +1435,6 @@ static void wait_for_readers(KEY_CACHE *keycache,
keycache_pthread_cond_wait(&thread->suspend, &keycache->cache_lock); keycache_pthread_cond_wait(&thread->suspend, &keycache->cache_lock);
block->condvar= NULL; block->condvar= NULL;
} }
#else
KEYCACHE_DBUG_ASSERT(block->hash_link->requests == 0);
#endif
} }
@ -1492,7 +1464,7 @@ static void unlink_hash(KEY_CACHE *keycache, HASH_LINK *hash_link)
if ((*hash_link->prev= hash_link->next)) if ((*hash_link->prev= hash_link->next))
hash_link->next->prev= hash_link->prev; hash_link->next->prev= hash_link->prev;
hash_link->block= NULL; hash_link->block= NULL;
#ifdef THREAD
if (keycache->waiting_for_hash_link.last_thread) if (keycache->waiting_for_hash_link.last_thread)
{ {
/* Signal that a free hash link has appeared */ /* Signal that a free hash link has appeared */
@ -1528,9 +1500,6 @@ static void unlink_hash(KEY_CACHE *keycache, HASH_LINK *hash_link)
hash_link); hash_link);
return; return;
} }
#else /* THREAD */
KEYCACHE_DBUG_ASSERT(! (keycache->waiting_for_hash_link.last_thread));
#endif /* THREAD */
hash_link->next= keycache->free_hash_list; hash_link->next= keycache->free_hash_list;
keycache->free_hash_list= hash_link; keycache->free_hash_list= hash_link;
} }
@ -1595,7 +1564,6 @@ restart:
} }
else else
{ {
#ifdef THREAD
/* Wait for a free hash link */ /* Wait for a free hash link */
struct st_my_thread_var *thread= my_thread_var; struct st_my_thread_var *thread= my_thread_var;
KEYCACHE_PAGE page; KEYCACHE_PAGE page;
@ -1609,9 +1577,6 @@ restart:
keycache_pthread_cond_wait(&thread->suspend, keycache_pthread_cond_wait(&thread->suspend,
&keycache->cache_lock); &keycache->cache_lock);
thread->opt_info= NULL; thread->opt_info= NULL;
#else
KEYCACHE_DBUG_ASSERT(0);
#endif
goto restart; goto restart;
} }
hash_link->file= file; hash_link->file= file;
@ -1731,7 +1696,6 @@ restart:
- block assigned but not yet read from file (invalid data). - block assigned but not yet read from file (invalid data).
*/ */
#ifdef THREAD
if (keycache->in_resize) if (keycache->in_resize)
{ {
/* This is a request during a resize operation */ /* This is a request during a resize operation */
@ -1973,9 +1937,6 @@ restart:
} }
DBUG_RETURN(0); DBUG_RETURN(0);
} }
#else /* THREAD */
DBUG_ASSERT(!keycache->in_resize);
#endif
if (page_status == PAGE_READ && if (page_status == PAGE_READ &&
(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH | (block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH |
@ -2105,7 +2066,6 @@ restart:
from the LRU ring. from the LRU ring.
*/ */
#ifdef THREAD
if (! keycache->used_last) if (! keycache->used_last)
{ {
/* /*
@ -2138,9 +2098,7 @@ restart:
DBUG_ASSERT(!hash_link->block->next_used); DBUG_ASSERT(!hash_link->block->next_used);
DBUG_ASSERT(!hash_link->block->prev_used); DBUG_ASSERT(!hash_link->block->prev_used);
} }
#else
KEYCACHE_DBUG_ASSERT(keycache->used_last);
#endif
/* /*
If we waited above, hash_link->block has been assigned by If we waited above, hash_link->block has been assigned by
link_block(). Otherwise it is still NULL. In the latter case link_block(). Otherwise it is still NULL. In the latter case
@ -2610,10 +2568,8 @@ uchar *key_cache_read(KEY_CACHE *keycache,
set_if_smaller(read_length, keycache->key_cache_block_size-offset); set_if_smaller(read_length, keycache->key_cache_block_size-offset);
KEYCACHE_DBUG_ASSERT(read_length > 0); KEYCACHE_DBUG_ASSERT(read_length > 0);
#ifndef THREAD
if (block_length > keycache->key_cache_block_size || offset) if (block_length > keycache->key_cache_block_size || offset)
return_buffer=0; return_buffer=0;
#endif
/* Request the cache block that matches file/pos. */ /* Request the cache block that matches file/pos. */
keycache->global_cache_r_requests++; keycache->global_cache_r_requests++;
@ -2673,9 +2629,6 @@ uchar *key_cache_read(KEY_CACHE *keycache,
/* block status may have added BLOCK_ERROR in the above 'if'. */ /* block status may have added BLOCK_ERROR in the above 'if'. */
if (!(block->status & BLOCK_ERROR)) if (!(block->status & BLOCK_ERROR))
{ {
#ifndef THREAD
if (! return_buffer)
#endif
{ {
DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE)); DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE));
#if !defined(SERIALIZED_READ_FROM_CACHE) #if !defined(SERIALIZED_READ_FROM_CACHE)
@ -2714,20 +2667,6 @@ uchar *key_cache_read(KEY_CACHE *keycache,
break; break;
} }
#ifndef THREAD
/* This is only true if we where able to read everything in one block */
if (return_buffer)
{
if (MYSQL_KEYCACHE_READ_DONE_ENABLED())
{
MYSQL_KEYCACHE_READ_DONE((ulong) (keycache->blocks_used *
keycache->key_cache_block_size),
(ulong) (keycache->blocks_unused *
keycache->key_cache_block_size));
}
DBUG_RETURN(block->buffer);
}
#endif
next_block: next_block:
buff+= read_length; buff+= read_length;
filepos+= read_length+offset; filepos+= read_length+offset;

View File

@ -53,9 +53,7 @@ typedef struct st_safe_hash_entry
typedef struct st_safe_hash_with_default typedef struct st_safe_hash_with_default
{ {
#ifdef THREAD
rw_lock_t mutex; rw_lock_t mutex;
#endif
HASH hash; HASH hash;
uchar *default_value; uchar *default_value;
SAFE_HASH_ENTRY *root; SAFE_HASH_ENTRY *root;

View File

@ -22,9 +22,6 @@
* the internal size is a set of 32 bit words * the internal size is a set of 32 bit words
* the number of bits specified in creation can be any number > 0 * the number of bits specified in creation can be any number > 0
* there are THREAD safe versions of most calls called bitmap_lock_* * there are THREAD safe versions of most calls called bitmap_lock_*
many of those are not used and not compiled normally but the code
already exist for them in an #ifdef:ed part. These can only be used
if THREAD was specified in bitmap_init
TODO: TODO:
Make assembler THREAD safe versions of these using test-and-set instructions Make assembler THREAD safe versions of these using test-and-set instructions
@ -85,18 +82,14 @@ void create_last_word_mask(MY_BITMAP *map)
static inline void bitmap_lock(MY_BITMAP *map __attribute__((unused))) static inline void bitmap_lock(MY_BITMAP *map __attribute__((unused)))
{ {
#ifdef THREAD
if (map->mutex) if (map->mutex)
mysql_mutex_lock(map->mutex); mysql_mutex_lock(map->mutex);
#endif
} }
static inline void bitmap_unlock(MY_BITMAP *map __attribute__((unused))) static inline void bitmap_unlock(MY_BITMAP *map __attribute__((unused)))
{ {
#ifdef THREAD
if (map->mutex) if (map->mutex)
mysql_mutex_unlock(map->mutex); mysql_mutex_unlock(map->mutex);
#endif
} }
@ -108,30 +101,30 @@ my_bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
{ {
uint size_in_bytes= bitmap_buffer_size(n_bits); uint size_in_bytes= bitmap_buffer_size(n_bits);
uint extra= 0; uint extra= 0;
#ifdef THREAD
if (thread_safe) if (thread_safe)
{ {
size_in_bytes= ALIGN_SIZE(size_in_bytes); size_in_bytes= ALIGN_SIZE(size_in_bytes);
extra= sizeof(mysql_mutex_t); extra= sizeof(mysql_mutex_t);
} }
map->mutex= 0; map->mutex= 0;
#endif
if (!(buf= (my_bitmap_map*) my_malloc(size_in_bytes+extra, MYF(MY_WME)))) if (!(buf= (my_bitmap_map*) my_malloc(size_in_bytes+extra, MYF(MY_WME))))
DBUG_RETURN(1); DBUG_RETURN(1);
#ifdef THREAD
if (thread_safe) if (thread_safe)
{ {
map->mutex= (mysql_mutex_t *) ((char*) buf + size_in_bytes); map->mutex= (mysql_mutex_t *) ((char*) buf + size_in_bytes);
mysql_mutex_init(key_BITMAP_mutex, map->mutex, MY_MUTEX_INIT_FAST); mysql_mutex_init(key_BITMAP_mutex, map->mutex, MY_MUTEX_INIT_FAST);
} }
#endif
} }
#ifdef THREAD
else else
{ {
DBUG_ASSERT(thread_safe == 0); DBUG_ASSERT(thread_safe == 0);
} }
#endif
map->bitmap= buf; map->bitmap= buf;
map->n_bits= n_bits; map->n_bits= n_bits;
@ -146,10 +139,9 @@ void bitmap_free(MY_BITMAP *map)
DBUG_ENTER("bitmap_free"); DBUG_ENTER("bitmap_free");
if (map->bitmap) if (map->bitmap)
{ {
#ifdef THREAD
if (map->mutex) if (map->mutex)
mysql_mutex_destroy(map->mutex); mysql_mutex_destroy(map->mutex);
#endif
my_free(map->bitmap); my_free(map->bitmap);
map->bitmap=0; map->bitmap=0;
} }

View File

@ -124,10 +124,9 @@ size_t my_fwrite(FILE *stream, const uchar *Buffer, size_t Count, myf MyFlags)
} }
#endif #endif
#if !defined(NO_BACKGROUND) && defined(USE_MY_STREAM) #if !defined(NO_BACKGROUND) && defined(USE_MY_STREAM)
#ifdef THREAD
if (my_thread_var->abort) if (my_thread_var->abort)
MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */ MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */
#endif
if ((errno == ENOSPC || errno == EDQUOT) && if ((errno == ENOSPC || errno == EDQUOT) &&
(MyFlags & MY_WAIT_IF_FULL)) (MyFlags & MY_WAIT_IF_FULL))
{ {

View File

@ -78,9 +78,7 @@ struct hostent *my_gethostbyname_r(const char *name,
#else /* !HAVE_GETHOSTBYNAME_R */ #else /* !HAVE_GETHOSTBYNAME_R */
#ifdef THREAD
extern mysql_mutex_t LOCK_gethostbyname_r; extern mysql_mutex_t LOCK_gethostbyname_r;
#endif
/* /*
No gethostbyname_r() function exists. No gethostbyname_r() function exists.

View File

@ -91,23 +91,22 @@ my_bool my_basic_init(void)
instrumented_stdin.m_psi= NULL; /* not yet instrumented */ instrumented_stdin.m_psi= NULL; /* not yet instrumented */
mysql_stdin= & instrumented_stdin; mysql_stdin= & instrumented_stdin;
#if defined(THREAD)
if (my_thread_global_init()) if (my_thread_global_init())
return 1; return 1;
#if defined(SAFE_MUTEX) #if defined(SAFE_MUTEX)
safe_mutex_global_init(); /* Must be called early */ safe_mutex_global_init(); /* Must be called early */
#endif #endif
#endif
#if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) #if defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX)
fastmutex_global_init(); /* Must be called early */ fastmutex_global_init(); /* Must be called early */
#endif #endif
#ifdef THREAD
#if defined(HAVE_PTHREAD_INIT) #if defined(HAVE_PTHREAD_INIT)
pthread_init(); /* Must be called before DBUG_ENTER */ pthread_init(); /* Must be called before DBUG_ENTER */
#endif #endif
if (my_thread_basic_global_init()) if (my_thread_basic_global_init())
return 1; return 1;
#endif
/* $HOME is needed early to parse configuration files located in ~/ */ /* $HOME is needed early to parse configuration files located in ~/ */
if ((home_dir= getenv("HOME")) != 0) if ((home_dir= getenv("HOME")) != 0)
@ -138,10 +137,9 @@ my_bool my_init(void)
if (my_basic_init()) if (my_basic_init())
return 1; return 1;
#ifdef THREAD
if (my_thread_global_init()) if (my_thread_global_init())
return 1; return 1;
#endif /* THREAD */
{ {
DBUG_ENTER("my_init"); DBUG_ENTER("my_init");
DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown")); DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown"));
@ -240,7 +238,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
{ {
DBUG_END(); /* Must be done before my_thread_end */ DBUG_END(); /* Must be done before my_thread_end */
} }
#ifdef THREAD
my_thread_end(); my_thread_end();
my_thread_global_end(); my_thread_global_end();
#if defined(SAFE_MUTEX) #if defined(SAFE_MUTEX)
@ -251,7 +249,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
safe_mutex_end((infoflag & (MY_GIVE_INFO | MY_CHECK_ERROR)) ? stderr : safe_mutex_end((infoflag & (MY_GIVE_INFO | MY_CHECK_ERROR)) ? stderr :
(FILE *) 0); (FILE *) 0);
#endif /* defined(SAFE_MUTEX) */ #endif /* defined(SAFE_MUTEX) */
#endif /* THREAD */
#ifdef __WIN__ #ifdef __WIN__
if (have_tcpip) if (have_tcpip)
@ -518,7 +515,7 @@ PSI_mutex_key key_BITMAP_mutex, key_IO_CACHE_append_buffer_lock,
static PSI_mutex_info all_mysys_mutexes[]= static PSI_mutex_info all_mysys_mutexes[]=
{ {
#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32) #if !defined(HAVE_PREAD) && !defined(_WIN32)
{ &key_my_file_info_mutex, "st_my_file_info:mutex", 0}, { &key_my_file_info_mutex, "st_my_file_info:mutex", 0},
#endif /* !defined(HAVE_PREAD) && !defined(_WIN32) */ #endif /* !defined(HAVE_PREAD) && !defined(_WIN32) */
#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R) #if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)

View File

@ -41,7 +41,7 @@
# endif # endif
#endif #endif
#if defined(THREAD) && defined(HAVE_READDIR_R) #if defined(HAVE_READDIR_R)
#define READDIR(A,B,C) ((errno=readdir_r(A,B,&C)) != 0 || !C) #define READDIR(A,B,C) ((errno=readdir_r(A,B,&C)) != 0 || !C)
#else #else
#define READDIR(A,B,C) (!(C=readdir(A))) #define READDIR(A,B,C) (!(C=readdir(A)))
@ -97,13 +97,12 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
DIR *dirp; DIR *dirp;
struct dirent *dp; struct dirent *dp;
char tmp_path[FN_REFLEN+1],*tmp_file; char tmp_path[FN_REFLEN+1],*tmp_file;
#ifdef THREAD
char dirent_tmp[sizeof(struct dirent)+_POSIX_PATH_MAX+1]; char dirent_tmp[sizeof(struct dirent)+_POSIX_PATH_MAX+1];
#endif
DBUG_ENTER("my_dir"); DBUG_ENTER("my_dir");
DBUG_PRINT("my",("path: '%s' MyFlags: %d",path,MyFlags)); DBUG_PRINT("my",("path: '%s' MyFlags: %d",path,MyFlags));
#if defined(THREAD) && !defined(HAVE_READDIR_R) #if !defined(HAVE_READDIR_R)
mysql_mutex_lock(&THR_LOCK_open); mysql_mutex_lock(&THR_LOCK_open);
#endif #endif
@ -135,11 +134,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
tmp_file=strend(tmp_path); tmp_file=strend(tmp_path);
#ifdef THREAD
dp= (struct dirent*) dirent_tmp; dp= (struct dirent*) dirent_tmp;
#else
dp=0;
#endif
while (!(READDIR(dirp,(struct dirent*) dirent_tmp,dp))) while (!(READDIR(dirp,(struct dirent*) dirent_tmp,dp)))
{ {
@ -166,7 +161,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
} }
(void) closedir(dirp); (void) closedir(dirp);
#if defined(THREAD) && !defined(HAVE_READDIR_R) #if !defined(HAVE_READDIR_R)
mysql_mutex_unlock(&THR_LOCK_open); mysql_mutex_unlock(&THR_LOCK_open);
#endif #endif
result->dir_entry= (FILEINFO *)dir_entries_storage->buffer; result->dir_entry= (FILEINFO *)dir_entries_storage->buffer;
@ -178,7 +173,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
DBUG_RETURN(result); DBUG_RETURN(result);
error: error:
#if defined(THREAD) && !defined(HAVE_READDIR_R) #if !defined(HAVE_READDIR_R)
mysql_mutex_unlock(&THR_LOCK_open); mysql_mutex_unlock(&THR_LOCK_open);
#endif #endif
my_errno=errno; my_errno=errno;

View File

@ -89,7 +89,7 @@ int my_close(File fd, myf MyFlags)
if ((uint) fd < my_file_limit && my_file_info[fd].type != UNOPEN) if ((uint) fd < my_file_limit && my_file_info[fd].type != UNOPEN)
{ {
my_free(my_file_info[fd].name); my_free(my_file_info[fd].name);
#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32) #if !defined(HAVE_PREAD) && !defined(_WIN32)
mysql_mutex_destroy(&my_file_info[fd].mutex); mysql_mutex_destroy(&my_file_info[fd].mutex);
#endif #endif
my_file_info[fd].type = UNOPEN; my_file_info[fd].type = UNOPEN;
@ -125,7 +125,7 @@ File my_register_filename(File fd, const char *FileName, enum file_type
{ {
if ((uint) fd >= my_file_limit) if ((uint) fd >= my_file_limit)
{ {
#if defined(THREAD) && !defined(HAVE_PREAD) #if !defined(HAVE_PREAD)
my_errno= EMFILE; my_errno= EMFILE;
#else #else
thread_safe_increment(my_file_opened,&THR_LOCK_open); thread_safe_increment(my_file_opened,&THR_LOCK_open);
@ -140,7 +140,7 @@ File my_register_filename(File fd, const char *FileName, enum file_type
my_file_opened++; my_file_opened++;
my_file_total_opened++; my_file_total_opened++;
my_file_info[fd].type = type_of_file; my_file_info[fd].type = type_of_file;
#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32) #if !defined(HAVE_PREAD) && !defined(_WIN32)
mysql_mutex_init(key_my_file_info_mutex, &my_file_info[fd].mutex, mysql_mutex_init(key_my_file_info_mutex, &my_file_info[fd].mutex,
MY_MUTEX_INIT_FAST); MY_MUTEX_INIT_FAST);
#endif #endif

View File

@ -85,14 +85,14 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
DBUG_PRINT("warning",("Read only %d bytes off %u from %d, errno: %d", DBUG_PRINT("warning",("Read only %d bytes off %u from %d, errno: %d",
(int) readbytes, (uint) Count,Filedes,my_errno)); (int) readbytes, (uint) Count,Filedes,my_errno));
#ifdef THREAD
if ((readbytes == 0 || readbytes == (size_t) -1) && errno == EINTR) if ((readbytes == 0 || readbytes == (size_t) -1) && errno == EINTR)
{ {
DBUG_PRINT("debug", ("my_pread() was interrupted and returned %d", DBUG_PRINT("debug", ("my_pread() was interrupted and returned %d",
(int) readbytes)); (int) readbytes));
continue; /* Interrupted */ continue; /* Interrupted */
} }
#endif
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{ {
if (readbytes == (size_t) -1) if (readbytes == (size_t) -1)
@ -173,10 +173,10 @@ size_t my_pwrite(File Filedes, const uchar *Buffer, size_t Count,
} }
DBUG_PRINT("error",("Write only %u bytes", (uint) writtenbytes)); DBUG_PRINT("error",("Write only %u bytes", (uint) writtenbytes));
#ifndef NO_BACKGROUND #ifndef NO_BACKGROUND
#ifdef THREAD
if (my_thread_var->abort) if (my_thread_var->abort)
MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */ MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */
#endif
if ((my_errno == ENOSPC || my_errno == EDQUOT) && if ((my_errno == ENOSPC || my_errno == EDQUOT) &&
(MyFlags & MY_WAIT_IF_FULL)) (MyFlags & MY_WAIT_IF_FULL))
{ {

View File

@ -18,7 +18,6 @@
#define DONT_REMAP_PTHREAD_FUNCTIONS #define DONT_REMAP_PTHREAD_FUNCTIONS
#include "mysys_priv.h" #include "mysys_priv.h"
#ifdef THREAD
#include <signal.h> #include <signal.h>
#include <m_string.h> #include <m_string.h>
#include <thr_alarm.h> #include <thr_alarm.h>
@ -468,4 +467,3 @@ int pthread_dummy(int ret)
{ {
return ret; return ret;
} }
#endif /* THREAD */

View File

@ -59,14 +59,14 @@ size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags)
DBUG_PRINT("warning",("Read only %d bytes off %lu from %d, errno: %d", DBUG_PRINT("warning",("Read only %d bytes off %lu from %d, errno: %d",
(int) readbytes, (ulong) Count, Filedes, (int) readbytes, (ulong) Count, Filedes,
my_errno)); my_errno));
#ifdef THREAD
if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR) if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR)
{ {
DBUG_PRINT("debug", ("my_read() was interrupted and returned %ld", DBUG_PRINT("debug", ("my_read() was interrupted and returned %ld",
(long) readbytes)); (long) readbytes));
continue; /* Interrupted */ continue; /* Interrupted */
} }
#endif
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{ {
if (readbytes == (size_t) -1) if (readbytes == (size_t) -1)

View File

@ -32,9 +32,7 @@ char curr_dir[FN_REFLEN]= {0},
ulong my_stream_opened=0,my_file_opened=0, my_tmp_file_created=0; ulong my_stream_opened=0,my_file_opened=0, my_tmp_file_created=0;
ulong my_file_total_opened= 0; ulong my_file_total_opened= 0;
int my_umask=0664, my_umask_dir=0777; int my_umask=0664, my_umask_dir=0777;
#ifndef THREAD
int my_errno=0;
#endif
struct st_my_file_info my_file_info_default[MY_NFILE]; struct st_my_file_info my_file_info_default[MY_NFILE];
uint my_file_limit= MY_NFILE; uint my_file_limit= MY_NFILE;
struct st_my_file_info *my_file_info= my_file_info_default; struct st_my_file_info *my_file_info= my_file_info_default;

View File

@ -22,7 +22,6 @@
#include <m_string.h> #include <m_string.h>
#include <signal.h> #include <signal.h>
#ifdef THREAD
pthread_key(struct st_my_thread_var*, THR_KEY_mysys); pthread_key(struct st_my_thread_var*, THR_KEY_mysys);
mysql_mutex_t THR_LOCK_malloc, THR_LOCK_open, mysql_mutex_t THR_LOCK_malloc, THR_LOCK_open,
THR_LOCK_lock, THR_LOCK_isam, THR_LOCK_myisam, THR_LOCK_heap, THR_LOCK_lock, THR_LOCK_isam, THR_LOCK_myisam, THR_LOCK_heap,
@ -532,4 +531,3 @@ static void install_sigabrt_handler(void)
} }
#endif #endif
#endif /* THREAD */

View File

@ -52,10 +52,9 @@ size_t my_write(File Filedes, const uchar *Buffer, size_t Count, myf MyFlags)
DBUG_PRINT("error",("Write only %ld bytes, error: %d", DBUG_PRINT("error",("Write only %ld bytes, error: %d",
(long) writtenbytes, my_errno)); (long) writtenbytes, my_errno));
#ifndef NO_BACKGROUND #ifndef NO_BACKGROUND
#ifdef THREAD
if (my_thread_var->abort) if (my_thread_var->abort)
MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */ MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */
#endif
if ((my_errno == ENOSPC || my_errno == EDQUOT) && if ((my_errno == ENOSPC || my_errno == EDQUOT) &&
(MyFlags & MY_WAIT_IF_FULL)) (MyFlags & MY_WAIT_IF_FULL))
{ {

View File

@ -24,7 +24,6 @@
#include <sys/resource.h> #include <sys/resource.h>
#endif #endif
#ifdef THREAD
#include <my_pthread.h> #include <my_pthread.h>
#ifdef HAVE_PSI_INTERFACE #ifdef HAVE_PSI_INTERFACE
@ -62,9 +61,6 @@ extern PSI_thread_key key_thread_alarm;
extern mysql_mutex_t THR_LOCK_malloc, THR_LOCK_open, THR_LOCK_keycache; extern mysql_mutex_t THR_LOCK_malloc, THR_LOCK_open, THR_LOCK_keycache;
extern mysql_mutex_t THR_LOCK_lock, THR_LOCK_isam, THR_LOCK_net; extern mysql_mutex_t THR_LOCK_lock, THR_LOCK_isam, THR_LOCK_net;
extern mysql_mutex_t THR_LOCK_charset, THR_LOCK_time; extern mysql_mutex_t THR_LOCK_charset, THR_LOCK_time;
#else /* THREAD */
#include <my_no_pthread.h>
#endif /* THREAD */
#include <mysql/psi/mysql_file.h> #include <mysql/psi/mysql_file.h>

View File

@ -18,7 +18,7 @@
#include "mysys_priv.h" #include "mysys_priv.h"
#include <my_global.h> #include <my_global.h>
#if defined(THREAD) && !defined(DONT_USE_THR_ALARM) #if !defined(DONT_USE_THR_ALARM)
#include <errno.h> #include <errno.h>
#include <my_pthread.h> #include <my_pthread.h>
#include <signal.h> #include <signal.h>
@ -686,15 +686,14 @@ void resize_thr_alarm(uint max_alarms)
#endif /* __WIN__ */ #endif /* __WIN__ */
#endif /* THREAD */ #endif
/**************************************************************************** /****************************************************************************
Handling of test case (when compiled with -DMAIN) Handling of test case (when compiled with -DMAIN)
***************************************************************************/ ***************************************************************************/
#ifdef MAIN #ifdef MAIN
#if defined(THREAD) && !defined(DONT_USE_THR_ALARM) #if !defined(DONT_USE_THR_ALARM)
static mysql_cond_t COND_thread_count; static mysql_cond_t COND_thread_count;
static mysql_mutex_t LOCK_thread_count; static mysql_mutex_t LOCK_thread_count;
@ -961,17 +960,13 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
return 0; return 0;
} }
#else /* THREAD */ #else /* !defined(DONT_USE_ALARM_THREAD) */
int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
{ {
#ifndef THREAD
printf("thr_alarm disabled because we are not using threads\n");
#else
printf("thr_alarm disabled with DONT_USE_THR_ALARM\n"); printf("thr_alarm disabled with DONT_USE_THR_ALARM\n");
#endif
exit(1); exit(1);
} }
#endif /* THREAD */ #endif /* !defined(DONT_USE_ALARM_THREAD) */
#endif /* MAIN */ #endif /* MAIN */

View File

@ -74,7 +74,6 @@ one TL_WRITE_DELAYED lock at the same time as multiple read locks.
#include "mysys_priv.h" #include "mysys_priv.h"
#ifdef THREAD
#include "thr_lock.h" #include "thr_lock.h"
#include <m_string.h> #include <m_string.h>
#include <errno.h> #include <errno.h>
@ -1451,7 +1450,6 @@ void thr_print_locks(void)
mysql_mutex_unlock(&THR_LOCK_lock); mysql_mutex_unlock(&THR_LOCK_lock);
} }
#endif /* THREAD */
/***************************************************************************** /*****************************************************************************
** Test of thread locks ** Test of thread locks
@ -1459,8 +1457,6 @@ void thr_print_locks(void)
#ifdef MAIN #ifdef MAIN
#ifdef THREAD
struct st_test { struct st_test {
uint lock_nr; uint lock_nr;
enum thr_lock_type lock_type; enum thr_lock_type lock_type;
@ -1689,13 +1685,4 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
return 0; return 0;
} }
#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 */ #endif /* MAIN */

View File

@ -19,7 +19,7 @@
#if defined(TARGET_OS_LINUX) && !defined (__USE_UNIX98) #if defined(TARGET_OS_LINUX) && !defined (__USE_UNIX98)
#define __USE_UNIX98 /* To get rw locks under Linux */ #define __USE_UNIX98 /* To get rw locks under Linux */
#endif #endif
#if defined(THREAD) && defined(SAFE_MUTEX) #if defined(SAFE_MUTEX)
#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */ #undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */
#include "mysys_priv.h" #include "mysys_priv.h"
#include "my_static.h" #include "my_static.h"
@ -395,9 +395,9 @@ void safe_mutex_end(FILE *file __attribute__((unused)))
#endif /* SAFE_MUTEX_DETECT_DESTROY */ #endif /* SAFE_MUTEX_DETECT_DESTROY */
} }
#endif /* THREAD && SAFE_MUTEX */ #endif /* SAFE_MUTEX */
#if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) #if defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX)
#include "mysys_priv.h" #include "mysys_priv.h"
#include "my_static.h" #include "my_static.h"
@ -500,4 +500,4 @@ void fastmutex_global_init(void)
#endif #endif
} }
#endif /* defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) */ #endif /* defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) */

View File

@ -16,7 +16,6 @@
/* Synchronization - readers / writer thread locks */ /* Synchronization - readers / writer thread locks */
#include "mysys_priv.h" #include "mysys_priv.h"
#if defined(THREAD)
#if defined(NEED_MY_RW_LOCK) #if defined(NEED_MY_RW_LOCK)
#include <errno.h> #include <errno.h>
@ -471,4 +470,3 @@ int rw_pr_unlock(rw_pr_lock_t *rwlock)
} }
#endif /* defined(THREAD) */

View File

@ -24,7 +24,6 @@
mysql_real_connect() mysql_real_connect()
- Support for reading local file with LOAD DATA LOCAL - Support for reading local file with LOAD DATA LOCAL
- SHARED memory handling - SHARED memory handling
- Protection against sigpipe
- Prepared statements - Prepared statements
- Things that only works for the server - Things that only works for the server
@ -70,9 +69,9 @@ my_bool net_flush(NET *net);
#include "mysqld_error.h" #include "mysqld_error.h"
#include "errmsg.h" #include "errmsg.h"
#include <violite.h> #include <violite.h>
#if defined(THREAD) && !defined(__WIN__) #if !defined(__WIN__)
#include <my_pthread.h> /* because of signal() */ #include <my_pthread.h> /* because of signal() */
#endif /* defined(THREAD) && !defined(__WIN__) */ #endif /* !defined(__WIN__) */
#include <sys/stat.h> #include <sys/stat.h>
#include <signal.h> #include <signal.h>
@ -287,7 +286,7 @@ static int wait_for_data(my_socket fd, uint timeout)
{ {
tv.tv_sec = (long) timeout; tv.tv_sec = (long) timeout;
tv.tv_usec = 0; tv.tv_usec = 0;
#if defined(HPUX10) && defined(THREAD) #if defined(HPUX10)
if ((res = select(fd+1, NULL, (int*) &sfds, NULL, &tv)) > 0) if ((res = select(fd+1, NULL, (int*) &sfds, NULL, &tv)) > 0)
break; break;
#else #else
@ -731,13 +730,9 @@ cli_safe_read(MYSQL *mysql)
{ {
NET *net= &mysql->net; NET *net= &mysql->net;
ulong len=0; ulong len=0;
init_sigpipe_variables
/* Don't give sigpipe errors if the client doesn't want them */
set_sigpipe(mysql);
if (net->vio != 0) if (net->vio != 0)
len=my_net_read(net); len=my_net_read(net);
reset_sigpipe(mysql);
if (len == packet_error || len == 0) if (len == packet_error || len == 0)
{ {
@ -817,13 +812,9 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
{ {
NET *net= &mysql->net; NET *net= &mysql->net;
my_bool result= 1; my_bool result= 1;
init_sigpipe_variables
my_bool stmt_skip= stmt ? stmt->state != MYSQL_STMT_INIT_DONE : FALSE; my_bool stmt_skip= stmt ? stmt->state != MYSQL_STMT_INIT_DONE : FALSE;
DBUG_ENTER("cli_advanced_command"); DBUG_ENTER("cli_advanced_command");
/* Don't give sigpipe errors if the client doesn't want them */
set_sigpipe(mysql);
if (mysql->net.vio == 0) if (mysql->net.vio == 0)
{ /* Do reconnect if possible */ { /* Do reconnect if possible */
if (mysql_reconnect(mysql) || stmt_skip) if (mysql_reconnect(mysql) || stmt_skip)
@ -872,7 +863,6 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
result= ((mysql->packet_length=cli_safe_read(mysql)) == packet_error ? result= ((mysql->packet_length=cli_safe_read(mysql)) == packet_error ?
1 : 0); 1 : 0);
end: end:
reset_sigpipe(mysql);
DBUG_PRINT("exit",("result: %d", result)); DBUG_PRINT("exit",("result: %d", result));
DBUG_RETURN(result); DBUG_RETURN(result);
} }
@ -1089,14 +1079,11 @@ void end_server(MYSQL *mysql)
DBUG_ENTER("end_server"); DBUG_ENTER("end_server");
if (mysql->net.vio != 0) if (mysql->net.vio != 0)
{ {
init_sigpipe_variables
DBUG_PRINT("info",("Net: %s", vio_description(mysql->net.vio))); DBUG_PRINT("info",("Net: %s", vio_description(mysql->net.vio)));
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
slave_io_thread_detach_vio(); slave_io_thread_detach_vio();
#endif #endif
set_sigpipe(mysql);
vio_delete(mysql->net.vio); vio_delete(mysql->net.vio);
reset_sigpipe(mysql);
mysql->net.vio= 0; /* Marker */ mysql->net.vio= 0; /* Marker */
mysql_prune_stmt_list(mysql); mysql_prune_stmt_list(mysql);
} }
@ -2939,7 +2926,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
#ifdef HAVE_SYS_UN_H #ifdef HAVE_SYS_UN_H
struct sockaddr_un UNIXaddr; struct sockaddr_un UNIXaddr;
#endif #endif
init_sigpipe_variables
DBUG_ENTER("mysql_real_connect"); DBUG_ENTER("mysql_real_connect");
DBUG_PRINT("enter",("host: %s db: %s user: %s (client)", DBUG_PRINT("enter",("host: %s db: %s user: %s (client)",
@ -2954,8 +2940,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/* Don't give sigpipe errors if the client doesn't want them */
set_sigpipe(mysql);
mysql->methods= &client_methods; mysql->methods= &client_methods;
net->vio = 0; /* If something goes wrong */ net->vio = 0; /* If something goes wrong */
mysql->client_flag=0; /* For handshake */ mysql->client_flag=0; /* For handshake */
@ -3465,11 +3449,9 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
#endif #endif
DBUG_PRINT("exit", ("Mysql handler: 0x%lx", (long) mysql)); DBUG_PRINT("exit", ("Mysql handler: 0x%lx", (long) mysql));
reset_sigpipe(mysql);
DBUG_RETURN(mysql); DBUG_RETURN(mysql);
error: error:
reset_sigpipe(mysql);
DBUG_PRINT("error",("message: %u/%s (%s)", DBUG_PRINT("error",("message: %u/%s (%s)",
net->last_errno, net->last_errno,
net->sqlstate, net->sqlstate,

View File

@ -31,11 +31,7 @@
#include "mysql.h" #include "mysql.h"
#include <my_sys.h> #include <my_sys.h>
#include <m_string.h> #include <m_string.h>
#ifdef THREAD
#include <my_pthread.h> #include <my_pthread.h>
#else
#include <my_no_pthread.h>
#endif
#include <sql_common.h> #include <sql_common.h>
#include "errmsg.h" #include "errmsg.h"
@ -67,9 +63,7 @@ static uint plugin_version[MYSQL_CLIENT_MAX_PLUGINS]=
loading the same plugin twice in parallel. loading the same plugin twice in parallel.
*/ */
struct st_client_plugin_int *plugin_list[MYSQL_CLIENT_MAX_PLUGINS]; struct st_client_plugin_int *plugin_list[MYSQL_CLIENT_MAX_PLUGINS];
#ifdef THREAD
static pthread_mutex_t LOCK_load_client_plugin; static pthread_mutex_t LOCK_load_client_plugin;
#endif
static int is_not_initialized(MYSQL *mysql, const char *name) static int is_not_initialized(MYSQL *mysql, const char *name)
{ {

View File

@ -27,9 +27,6 @@
CLIENT_SECURE_CONNECTION | CLIENT_TRANSACTIONS | \ CLIENT_SECURE_CONNECTION | CLIENT_TRANSACTIONS | \
CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION) CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION)
#define init_sigpipe_variables
#define set_sigpipe(mysql)
#define reset_sigpipe(mysql)
#define read_user_name(A) {} #define read_user_name(A) {}
#undef HAVE_SMEM #undef HAVE_SMEM
#undef _CUSTOMCONFIG_ #undef _CUSTOMCONFIG_

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -33,10 +33,6 @@
#include "sql_test.h" // TEST_filesort #include "sql_test.h" // TEST_filesort
#include "opt_range.h" // SQL_SELECT #include "opt_range.h" // SQL_SELECT
#ifndef THREAD
#define SKIP_DBUG_IN_FILESORT
#endif
/// How to write record_ref. /// How to write record_ref.
#define WRITE_REF(file,from) \ #define WRITE_REF(file,from) \
if (my_b_write((file),(uchar*) (from),param->ref_length)) \ if (my_b_write((file),(uchar*) (from),param->ref_length)) \

View File

@ -17,9 +17,7 @@
#include <my_base.h> /* This includes global */ #include <my_base.h> /* This includes global */
C_MODE_START C_MODE_START
#ifdef THREAD
#include <my_pthread.h> #include <my_pthread.h>
#endif
#include "heap.h" /* Structs & some defines */ #include "heap.h" /* Structs & some defines */
#include "my_tree.h" #include "my_tree.h"
@ -102,14 +100,11 @@ extern void hp_clear(HP_SHARE *info);
extern void hp_clear_keys(HP_SHARE *info); extern void hp_clear_keys(HP_SHARE *info);
extern uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, extern uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
key_part_map keypart_map); key_part_map keypart_map);
#ifdef THREAD
extern mysql_mutex_t THR_LOCK_heap; extern mysql_mutex_t THR_LOCK_heap;
#endif
#ifdef HAVE_PSI_INTERFACE #ifdef HAVE_PSI_INTERFACE
#ifdef THREAD
extern PSI_mutex_key hp_key_mutex_HP_SHARE_intern_lock; extern PSI_mutex_key hp_key_mutex_HP_SHARE_intern_lock;
#endif /* THREAD */
void init_heap_psi_keys(); void init_heap_psi_keys();
#endif /* HAVE_PSI_INTERFACE */ #endif /* HAVE_PSI_INTERFACE */

View File

@ -86,7 +86,6 @@ int hp_get_new_block(HP_BLOCK *block, size_t *alloc_length)
} }
else else
{ {
dont_break(); /* Dont allow SIGHUP or SIGINT */
if ((uint) i == block->levels) if ((uint) i == block->levels)
{ {
/* Adding a new level on top of the existing ones. */ /* Adding a new level on top of the existing ones. */
@ -117,7 +116,6 @@ int hp_get_new_block(HP_BLOCK *block, size_t *alloc_length)
allocated bytes. Use it as a leaf block. allocated bytes. Use it as a leaf block.
*/ */
block->level_info[0].last_blocks= root; block->level_info[0].last_blocks= root;
allow_break(); /* Allow SIGHUP & SIGINT */
} }
return 0; return 0;
} }

View File

@ -192,11 +192,9 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info,
my_free(share); my_free(share);
goto err; goto err;
} }
#ifdef THREAD
thr_lock_init(&share->lock); thr_lock_init(&share->lock);
mysql_mutex_init(hp_key_mutex_HP_SHARE_intern_lock, mysql_mutex_init(hp_key_mutex_HP_SHARE_intern_lock,
&share->intern_lock, MY_MUTEX_INIT_FAST); &share->intern_lock, MY_MUTEX_INIT_FAST);
#endif
if (!create_info->internal_table) if (!create_info->internal_table)
{ {
share->open_list.data= (void*) share; share->open_list.data= (void*) share;
@ -301,10 +299,8 @@ void hp_free(HP_SHARE *share)
if (share->open_list.data) /* If not internal table */ if (share->open_list.data) /* If not internal table */
heap_share_list= list_delete(heap_share_list, &share->open_list); heap_share_list= list_delete(heap_share_list, &share->open_list);
hp_clear(share); /* Remove blocks from memory */ hp_clear(share); /* Remove blocks from memory */
#ifdef THREAD
thr_lock_delete(&share->lock); thr_lock_delete(&share->lock);
mysql_mutex_destroy(&share->intern_lock); mysql_mutex_destroy(&share->intern_lock);
#endif
my_free(share->name); my_free(share->name);
my_free(share); my_free(share);
return; return;

View File

@ -37,9 +37,7 @@ HP_INFO *heap_open_from_share(HP_SHARE *share, int mode)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
share->open_count++; share->open_count++;
#ifdef THREAD
thr_lock_data_init(&share->lock,&info->lock,NULL); thr_lock_data_init(&share->lock,&info->lock,NULL);
#endif
info->s= share; info->s= share;
info->lastkey= (uchar*) (info + 1); info->lastkey= (uchar*) (info + 1);
info->recbuf= (uchar*) (info->lastkey + share->max_key_length); info->recbuf= (uchar*) (info->lastkey + share->max_key_length);

View File

@ -25,7 +25,6 @@
LIST *heap_open_list=0,*heap_share_list=0; LIST *heap_open_list=0,*heap_share_list=0;
#ifdef HAVE_PSI_INTERFACE #ifdef HAVE_PSI_INTERFACE
#ifdef THREAD
PSI_mutex_key hp_key_mutex_HP_SHARE_intern_lock; PSI_mutex_key hp_key_mutex_HP_SHARE_intern_lock;
static PSI_mutex_info all_heap_mutexes[]= static PSI_mutex_info all_heap_mutexes[]=
@ -36,11 +35,9 @@ static PSI_mutex_info all_heap_mutexes[]=
THR_LOCK_heap is part of mysys, not storage/heap. THR_LOCK_heap is part of mysys, not storage/heap.
*/ */
}; };
#endif /* THREAD */
void init_heap_psi_keys() void init_heap_psi_keys()
{ {
#ifdef THREAD
const char* category= "memory"; const char* category= "memory";
int count; int count;
@ -49,7 +46,6 @@ void init_heap_psi_keys()
count= array_elements(all_heap_mutexes); count= array_elements(all_heap_mutexes);
PSI_server->register_mutex(category, all_heap_mutexes, count); PSI_server->register_mutex(category, all_heap_mutexes, count);
#endif /* THREAD */
} }
#endif /* HAVE_PSI_INTERFACE */ #endif /* HAVE_PSI_INTERFACE */

View File

@ -1,4 +1,5 @@
/* Copyright (C) 2000-2003, 2006 MySQL AB /* Copyright (C) 2000, 2011, Oracle and/or its affiliates. All rights
reserved
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -656,11 +657,6 @@ static int rnd(int max_value)
static sig_handler endprog(int sig_number __attribute__((unused))) static sig_handler endprog(int sig_number __attribute__((unused)))
{ {
#ifndef THREAD
if (my_dont_interrupt)
my_remember_signal(sig_number,endprog);
else
#endif
{ {
hp_panic(HA_PANIC_CLOSE); hp_panic(HA_PANIC_CLOSE);
my_end(1); my_end(1);

View File

@ -168,10 +168,9 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
Also we likely need to lock mutex here (in both cases with protocol and Also we likely need to lock mutex here (in both cases with protocol and
push_warning). push_warning).
*/ */
#ifdef THREAD
if (param->need_print_msg_lock) if (param->need_print_msg_lock)
mysql_mutex_lock(&param->print_msg_mutex); mysql_mutex_lock(&param->print_msg_mutex);
#endif
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(name, length, system_charset_info); protocol->store(name, length, system_charset_info);
protocol->store(param->op_name, system_charset_info); protocol->store(param->op_name, system_charset_info);
@ -180,10 +179,10 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
if (protocol->write()) if (protocol->write())
sql_print_error("Failed on my_net_write, writing to stderr instead: %s\n", sql_print_error("Failed on my_net_write, writing to stderr instead: %s\n",
msgbuf); msgbuf);
#ifdef THREAD
if (param->need_print_msg_lock) if (param->need_print_msg_lock)
mysql_mutex_unlock(&param->print_msg_mutex); mysql_mutex_unlock(&param->print_msg_mutex);
#endif
return; return;
} }

View File

@ -99,9 +99,7 @@ void myisamchk_init(MI_CHECK *param)
param->max_record_length= LONGLONG_MAX; param->max_record_length= LONGLONG_MAX;
param->key_cache_block_size= KEY_CACHE_BLOCK_SIZE; param->key_cache_block_size= KEY_CACHE_BLOCK_SIZE;
param->stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL; param->stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL;
#ifdef THREAD
param->need_print_msg_lock= 0; param->need_print_msg_lock= 0;
#endif
} }
/* Check the status flags for the table */ /* Check the status flags for the table */
@ -2631,9 +2629,6 @@ err:
int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
const char * name, int rep_quick) const char * name, int rep_quick)
{ {
#ifndef THREAD
return mi_repair_by_sort(param, info, name, rep_quick);
#else
int got_error; int got_error;
uint i,key, total_key_length, istep; uint i,key, total_key_length, istep;
ulong rec_length; ulong rec_length;
@ -3122,7 +3117,6 @@ err:
share->pack.header_length=0; share->pack.header_length=0;
} }
DBUG_RETURN(got_error); DBUG_RETURN(got_error);
#endif /* THREAD */
} }
/* Read next record and return next key */ /* Read next record and return next key */

View File

@ -91,7 +91,6 @@ int mi_close(register MI_INFO *info)
my_free(share->decode_trees); my_free(share->decode_trees);
my_free(share->decode_tables); my_free(share->decode_tables);
} }
#ifdef THREAD
thr_lock_delete(&share->lock); thr_lock_delete(&share->lock);
mysql_mutex_destroy(&share->intern_lock); mysql_mutex_destroy(&share->intern_lock);
{ {
@ -102,7 +101,6 @@ int mi_close(register MI_INFO *info)
mysql_rwlock_destroy(&share->key_root_lock[i]); mysql_rwlock_destroy(&share->key_root_lock[i]);
} }
} }
#endif
my_free(info->s); my_free(info->s);
} }
mysql_mutex_unlock(&THR_LOCK_myisam); mysql_mutex_unlock(&THR_LOCK_myisam);

View File

@ -102,7 +102,7 @@ int mi_delete(MI_INFO *info,const uchar *record)
mi_sizestore(lastpos,info->lastpos); mi_sizestore(lastpos,info->lastpos);
myisam_log_command(MI_LOG_DELETE,info,(uchar*) lastpos,sizeof(lastpos),0); myisam_log_command(MI_LOG_DELETE,info,(uchar*) lastpos,sizeof(lastpos),0);
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE); (void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
allow_break(); /* Allow SIGHUP & SIGINT */
if (info->invalidator != 0) if (info->invalidator != 0)
{ {
DBUG_PRINT("info", ("invalidator... '%s' (delete)", info->filename)); DBUG_PRINT("info", ("invalidator... '%s' (delete)", info->filename));
@ -122,7 +122,6 @@ err:
} }
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE); (void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
info->update|=HA_STATE_WRITTEN; /* Buffer changed */ info->update|=HA_STATE_WRITTEN; /* Buffer changed */
allow_break(); /* Allow SIGHUP & SIGINT */
my_errno=save_errno; my_errno=save_errno;
if (save_errno == HA_ERR_KEY_NOT_FOUND) if (save_errno == HA_ERR_KEY_NOT_FOUND)
{ {

View File

@ -66,7 +66,6 @@ int mi_delete_all_rows(MI_INFO *info)
if (share->file_map) if (share->file_map)
mi_dynmap_file(info, (my_off_t) 0); mi_dynmap_file(info, (my_off_t) 0);
#endif #endif
allow_break(); /* Allow SIGHUP & SIGINT */
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
@ -74,7 +73,6 @@ err:
int save_errno=my_errno; int save_errno=my_errno;
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE); (void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
info->update|=HA_STATE_WRITTEN; /* Buffer changed */ info->update|=HA_STATE_WRITTEN; /* Buffer changed */
allow_break(); /* Allow SIGHUP & SIGINT */
DBUG_RETURN(my_errno=save_errno); DBUG_RETURN(my_errno=save_errno);
} }
} /* mi_delete */ } /* mi_delete */

View File

@ -39,13 +39,11 @@ static int delete_dynamic_record(MI_INFO *info,my_off_t filepos,
static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos, static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
uint length); uint length);
#ifdef THREAD
/* Play it safe; We have a small stack when using threads */ /* Play it safe; We have a small stack when using threads */
#undef my_alloca #undef my_alloca
#undef my_afree #undef my_afree
#define my_alloca(A) my_malloc((A),MYF(0)) #define my_alloca(A) my_malloc((A),MYF(0))
#define my_afree(A) my_free((A)) #define my_afree(A) my_free((A))
#endif
/* Interface function from MI_INFO */ /* Interface function from MI_INFO */
@ -1579,9 +1577,6 @@ int _mi_cmp_dynamic_record(register MI_INFO *info, register const uchar *record)
MI_BLOCK_INFO block_info; MI_BLOCK_INFO block_info;
DBUG_ENTER("_mi_cmp_dynamic_record"); DBUG_ENTER("_mi_cmp_dynamic_record");
/* We are going to do changes; dont let anybody disturb */
dont_break(); /* Dont allow SIGHUP or SIGINT */
if (info->opt_flag & WRITE_CACHE_USED) if (info->opt_flag & WRITE_CACHE_USED)
{ {
info->update&= ~(HA_STATE_WRITE_AT_END | HA_STATE_EXTEND_BLOCK); info->update&= ~(HA_STATE_WRITE_AT_END | HA_STATE_EXTEND_BLOCK);

View File

@ -24,11 +24,7 @@
#endif #endif
#undef GETPID /* For HPUX */ #undef GETPID /* For HPUX */
#ifdef THREAD
#define GETPID() (log_type == 1 ? (long) myisam_pid : (long) my_thread_dbug_id()) #define GETPID() (log_type == 1 ? (long) myisam_pid : (long) my_thread_dbug_id())
#else
#define GETPID() myisam_pid
#endif
/* Activate logging if flag is 1 and reset logging if flag is 0 */ /* Activate logging if flag is 1 and reset logging if flag is 0 */

View File

@ -286,9 +286,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
&share->state.key_root,keys*sizeof(my_off_t), &share->state.key_root,keys*sizeof(my_off_t),
&share->state.key_del, &share->state.key_del,
(share->state.header.max_block_size_index*sizeof(my_off_t)), (share->state.header.max_block_size_index*sizeof(my_off_t)),
#ifdef THREAD
&share->key_root_lock, sizeof(mysql_rwlock_t)*keys, &share->key_root_lock, sizeof(mysql_rwlock_t)*keys,
#endif
&share->mmap_lock, sizeof(mysql_rwlock_t), &share->mmap_lock, sizeof(mysql_rwlock_t),
NullS)) NullS))
goto err; goto err;
@ -498,7 +496,6 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
my_afree(disk_cache); my_afree(disk_cache);
mi_setup_functions(share); mi_setup_functions(share);
share->is_log_table= FALSE; share->is_log_table= FALSE;
#ifdef THREAD
thr_lock_init(&share->lock); thr_lock_init(&share->lock);
mysql_mutex_init(mi_key_mutex_MYISAM_SHARE_intern_lock, mysql_mutex_init(mi_key_mutex_MYISAM_SHARE_intern_lock,
&share->intern_lock, MY_MUTEX_INIT_FAST); &share->intern_lock, MY_MUTEX_INIT_FAST);
@ -528,7 +525,6 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share->lock.check_status=mi_check_status; share->lock.check_status=mi_check_status;
} }
} }
#endif
/* /*
Memory mapping can only be requested after initializing intern_lock. Memory mapping can only be requested after initializing intern_lock.
*/ */
@ -625,9 +621,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
bzero(info.rec_buff, mi_get_rec_buff_len(&info, info.rec_buff)); bzero(info.rec_buff, mi_get_rec_buff_len(&info, info.rec_buff));
*m_info=info; *m_info=info;
#ifdef THREAD
thr_lock_data_init(&share->lock,&m_info->lock,(void*) m_info); thr_lock_data_init(&share->lock,&m_info->lock,(void*) m_info);
#endif
m_info->open_list.data=(void*) m_info; m_info->open_list.data=(void*) m_info;
myisam_open_list=list_add(myisam_open_list,&m_info->open_list); myisam_open_list=list_add(myisam_open_list,&m_info->open_list);

View File

@ -32,7 +32,7 @@ File myisam_log_file= -1;
uint myisam_quick_table_bits=9; uint myisam_quick_table_bits=9;
ulong myisam_block_size= MI_KEY_BLOCK_LENGTH; /* Best by test */ ulong myisam_block_size= MI_KEY_BLOCK_LENGTH; /* Best by test */
my_bool myisam_flush=0, myisam_delay_key_write=0, myisam_single_user=0; my_bool myisam_flush=0, myisam_delay_key_write=0, myisam_single_user=0;
#if defined(THREAD) && !defined(DONT_USE_RW_LOCKS) #if !defined(DONT_USE_RW_LOCKS)
ulong myisam_concurrent_insert= 2; ulong myisam_concurrent_insert= 2;
#else #else
ulong myisam_concurrent_insert= 0; ulong myisam_concurrent_insert= 0;

View File

@ -114,9 +114,6 @@ int _mi_cmp_static_record(register MI_INFO *info, register const uchar *old)
{ {
DBUG_ENTER("_mi_cmp_static_record"); DBUG_ENTER("_mi_cmp_static_record");
/* We are going to do changes; dont let anybody disturb */
dont_break(); /* Dont allow SIGHUP or SIGINT */
if (info->opt_flag & WRITE_CACHE_USED) if (info->opt_flag & WRITE_CACHE_USED)
{ {
if (flush_io_cache(&info->rec_cache)) if (flush_io_cache(&info->rec_cache))

View File

@ -179,7 +179,6 @@ int mi_update(register MI_INFO *info, const uchar *oldrec, uchar *newrec)
there is no index change there could be data change. there is no index change there could be data change.
*/ */
(void) _mi_writeinfo(info, WRITEINFO_UPDATE_KEYFILE); (void) _mi_writeinfo(info, WRITEINFO_UPDATE_KEYFILE);
allow_break(); /* Allow SIGHUP & SIGINT */
if (info->invalidator != 0) if (info->invalidator != 0)
{ {
DBUG_PRINT("info", ("invalidator... '%s' (update)", info->filename)); DBUG_PRINT("info", ("invalidator... '%s' (update)", info->filename));
@ -230,7 +229,6 @@ err:
err_end: err_end:
myisam_log_record(MI_LOG_UPDATE,info,newrec,info->lastpos,my_errno); myisam_log_record(MI_LOG_UPDATE,info,newrec,info->lastpos,my_errno);
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE); (void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
allow_break(); /* Allow SIGHUP & SIGINT */
if (save_errno == HA_ERR_KEY_NOT_FOUND) if (save_errno == HA_ERR_KEY_NOT_FOUND)
{ {
mi_print_error(info->s, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);

View File

@ -60,7 +60,7 @@ int mi_write(MI_INFO *info, uchar *record)
} }
if (_mi_readinfo(info,F_WRLCK,1)) if (_mi_readinfo(info,F_WRLCK,1))
DBUG_RETURN(my_errno); DBUG_RETURN(my_errno);
dont_break(); /* Dont allow SIGHUP or SIGINT */
filepos= ((share->state.dellink != HA_OFFSET_ERROR && filepos= ((share->state.dellink != HA_OFFSET_ERROR &&
!info->append_insert_at_end) ? !info->append_insert_at_end) ?
share->state.dellink : share->state.dellink :
@ -169,7 +169,6 @@ int mi_write(MI_INFO *info, uchar *record)
if (share->is_log_table) if (share->is_log_table)
mi_update_status((void*) info); mi_update_status((void*) info);
allow_break(); /* Allow SIGHUP & SIGINT */
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
@ -228,7 +227,6 @@ err2:
save_errno=my_errno; save_errno=my_errno;
myisam_log_record(MI_LOG_WRITE,info,record,filepos,my_errno); myisam_log_record(MI_LOG_WRITE,info,record,filepos,my_errno);
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE); (void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
allow_break(); /* Allow SIGHUP & SIGINT */
DBUG_RETURN(my_errno=save_errno); DBUG_RETURN(my_errno=save_errno);
} /* mi_write */ } /* mi_write */

View File

@ -18,12 +18,8 @@
#include "myisam.h" /* Structs & some defines */ #include "myisam.h" /* Structs & some defines */
#include "myisampack.h" /* packing of keys */ #include "myisampack.h" /* packing of keys */
#include <my_tree.h> #include <my_tree.h>
#ifdef THREAD
#include <my_pthread.h> #include <my_pthread.h>
#include <thr_lock.h> #include <thr_lock.h>
#else
#include <my_no_pthread.h>
#endif
#include <mysql/psi/mysql_file.h> #include <mysql/psi/mysql_file.h>
/* undef map from my_nosys; We need test-if-disk full */ /* undef map from my_nosys; We need test-if-disk full */
@ -211,11 +207,10 @@ typedef struct st_mi_isam_share { /* Shared between opens */
not_flushed, not_flushed,
temporary,delay_key_write, temporary,delay_key_write,
concurrent_insert; concurrent_insert;
#ifdef THREAD
THR_LOCK lock; THR_LOCK lock;
mysql_mutex_t intern_lock; /* Locking for use with _locking */ mysql_mutex_t intern_lock; /* Locking for use with _locking */
mysql_rwlock_t *key_root_lock; mysql_rwlock_t *key_root_lock;
#endif
my_off_t mmaped_length; my_off_t mmaped_length;
uint nonmmaped_inserts; /* counter of writing in non-mmaped uint nonmmaped_inserts; /* counter of writing in non-mmaped
area */ area */
@ -298,9 +293,7 @@ struct st_myisam_info {
#ifdef __WIN__ #ifdef __WIN__
my_bool owned_by_merge; /* This MyISAM table is part of a merge union */ my_bool owned_by_merge; /* This MyISAM table is part of a merge union */
#endif #endif
#ifdef THREAD
THR_LOCK_DATA lock; THR_LOCK_DATA lock;
#endif
uchar *rtree_recursion_state; /* For RTREE */ uchar *rtree_recursion_state; /* For RTREE */
int rtree_recursion_depth; int rtree_recursion_depth;
}; };
@ -461,10 +454,9 @@ typedef struct st_mi_sort_param
#define MI_UNIQUE_HASH_TYPE HA_KEYTYPE_ULONG_INT #define MI_UNIQUE_HASH_TYPE HA_KEYTYPE_ULONG_INT
#define mi_unique_store(A,B) mi_int4store((A),(B)) #define mi_unique_store(A,B) mi_int4store((A),(B))
#ifdef THREAD
extern mysql_mutex_t THR_LOCK_myisam; extern mysql_mutex_t THR_LOCK_myisam;
#endif
#if !defined(THREAD) || defined(DONT_USE_RW_LOCKS) #if defined(DONT_USE_RW_LOCKS)
#define mysql_rwlock_wrlock(A) {} #define mysql_rwlock_wrlock(A) {}
#define mysql_rwlock_rdlock(A) {} #define mysql_rwlock_rdlock(A) {}
#define mysql_rwlock_unlock(A) {} #define mysql_rwlock_unlock(A) {}
@ -774,9 +766,7 @@ void mi_check_print_info(MI_CHECK *param, const char *fmt,...);
int flush_pending_blocks(MI_SORT_PARAM *param); int flush_pending_blocks(MI_SORT_PARAM *param);
int sort_ft_buf_flush(MI_SORT_PARAM *sort_param); int sort_ft_buf_flush(MI_SORT_PARAM *sort_param);
int thr_write_keys(MI_SORT_PARAM *sort_param); int thr_write_keys(MI_SORT_PARAM *sort_param);
#ifdef THREAD
pthread_handler_t thr_find_all_keys(void *arg); pthread_handler_t thr_find_all_keys(void *arg);
#endif
int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file); int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file);
int sort_write_record(MI_SORT_PARAM *sort_param); int sort_write_record(MI_SORT_PARAM *sort_param);

View File

@ -302,7 +302,6 @@ static ha_rows find_all_keys(MI_SORT_PARAM *info, uint keys,
} /* find_all_keys */ } /* find_all_keys */
#ifdef THREAD
/* Search after all keys and place them in a temp. file */ /* Search after all keys and place them in a temp. file */
pthread_handler_t thr_find_all_keys(void *arg) pthread_handler_t thr_find_all_keys(void *arg)
@ -637,7 +636,6 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
my_free(mergebuf); my_free(mergebuf);
DBUG_RETURN(got_error); DBUG_RETURN(got_error);
} }
#endif /* THREAD */
/* Write all keys in memory to file for later merge */ /* Write all keys in memory to file for later merge */

View File

@ -23,9 +23,7 @@
extern LIST *myrg_open_list; extern LIST *myrg_open_list;
#ifdef THREAD
extern mysql_mutex_t THR_LOCK_open; extern mysql_mutex_t THR_LOCK_open;
#endif
int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag); int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag);
int _myrg_mi_read_record(MI_INFO *info, uchar *buf); int _myrg_mi_read_record(MI_INFO *info, uchar *buf);

View File

@ -15,15 +15,6 @@
#include <my_global.h> #include <my_global.h>
#ifndef THREAD
int main(int argc __attribute__((unused)), char **argv __attribute__((unused)))
{
printf("This test must be compiled with multithread support to work\n");
exit(1);
}
#else
#include <my_sys.h> #include <my_sys.h>
#include <my_pthread.h> #include <my_pthread.h>
#include "mysql.h" #include "mysql.h"
@ -254,4 +245,3 @@ int main(int argc, char **argv)
return 0; /* Keep some compilers happy */ return 0; /* Keep some compilers happy */
} }
#endif /* THREAD */