Fix for SAFE_MUTEX on windows
Docs/manual.texi: cleanup include/my_pthread.h: Fix for SAFEMUTEX under windows mysys/my_thr_init.c: Fix for SAFEMUTEX under windows mysys/my_winthread.c: Fix for SAFEMUTEX under windows mysys/thr_mutex.c: Fix for SAFEMUTEX under windows sql/mysqld.cc: Remove unused code sql/sql_table.cc: Fix filename comparison on Windows support-files/Makefile.am: Added magic file
This commit is contained in:
parent
5993b4947b
commit
0d788b1e91
@ -1385,14 +1385,14 @@ and PHP's @strong{MySQL}-related functions
|
|||||||
@item Price @tab $34.95
|
@item Price @tab $34.95
|
||||||
@end multitable
|
@end multitable
|
||||||
|
|
||||||
This book teaches you how to use @strong{MySQL} and @code{mSQL}, two popular and
|
This book teaches you how to use @strong{MySQL} and @code{mSQL}, two
|
||||||
robust database products that support key subsets of SQL on both Linux
|
popular and robust database products that support key subsets of SQL on
|
||||||
and UNIX systems. Anyone who knows basic C, Java, Perl, or Python can
|
both Linux and UNIX systems. Anyone who knows basic C, Java, Perl, or
|
||||||
write a program to interact with a database, either as a stand-alone
|
Python can write a program to interact with a database, either as a
|
||||||
application or through a Web page. This book takes you through the
|
stand-alone application or through a Web page. This book takes you
|
||||||
whole process, from installation and configuration to programming
|
through the whole process, from installation and configuration to
|
||||||
interfaces and basic administration. Includes ample tutorial
|
programming interfaces and basic administration. Includes ample
|
||||||
material.
|
tutorial material.
|
||||||
|
|
||||||
@multitable @columnfractions .3 .7
|
@multitable @columnfractions .3 .7
|
||||||
@item Title @tab @uref{http://shop.barnesandnoble.com/bookSearch/isbnInquiry.asp?isbn=0672319144,Sams Teach Yourself MySQL in 21 Days}
|
@item Title @tab @uref{http://shop.barnesandnoble.com/bookSearch/isbnInquiry.asp?isbn=0672319144,Sams Teach Yourself MySQL in 21 Days}
|
||||||
|
@ -85,6 +85,7 @@ void pthread_exit(unsigned A); /* was #define pthread_exit(A) ExitThread(A)*/
|
|||||||
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE
|
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE
|
||||||
|
|
||||||
#ifdef USE_TLS /* For LIBMYSQL.DLL */
|
#ifdef USE_TLS /* For LIBMYSQL.DLL */
|
||||||
|
#undef SAFE_MUTEX /* This will cause conflicts */
|
||||||
#define pthread_key(T,V) DWORD V
|
#define pthread_key(T,V) DWORD V
|
||||||
#define pthread_key_create(A,B) ((*A=TlsAlloc())==0xFFFFFFFF)
|
#define pthread_key_create(A,B) ((*A=TlsAlloc())==0xFFFFFFFF)
|
||||||
#define pthread_getspecific(A) (TlsGetValue(A))
|
#define pthread_getspecific(A) (TlsGetValue(A))
|
||||||
|
@ -77,10 +77,19 @@ void my_thread_global_end(void)
|
|||||||
|
|
||||||
static long thread_id=0;
|
static long thread_id=0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
We can't use mutex_locks here if we re using windows as
|
||||||
|
we may have compiled the program with SAFE_MUTEX, in which
|
||||||
|
case the checking of mutex_locks will not work until
|
||||||
|
the pthread_self thread specific variable is initialized.
|
||||||
|
*/
|
||||||
|
|
||||||
my_bool my_thread_init(void)
|
my_bool my_thread_init(void)
|
||||||
{
|
{
|
||||||
struct st_my_thread_var *tmp;
|
struct st_my_thread_var *tmp;
|
||||||
|
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
|
||||||
pthread_mutex_lock(&THR_LOCK_lock);
|
pthread_mutex_lock(&THR_LOCK_lock);
|
||||||
|
#endif
|
||||||
#if !defined(__WIN__) || defined(USE_TLS)
|
#if !defined(__WIN__) || defined(USE_TLS)
|
||||||
if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys))
|
if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys))
|
||||||
{
|
{
|
||||||
@ -98,9 +107,11 @@ my_bool my_thread_init(void)
|
|||||||
pthread_setspecific(THR_KEY_mysys,tmp);
|
pthread_setspecific(THR_KEY_mysys,tmp);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
if (THR_KEY_mysys.id) /* Allready initialized */
|
if (THR_KEY_mysys.id) /* Already initialized */
|
||||||
{
|
{
|
||||||
|
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
|
||||||
pthread_mutex_unlock(&THR_LOCK_lock);
|
pthread_mutex_unlock(&THR_LOCK_lock);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
tmp= &THR_KEY_mysys;
|
tmp= &THR_KEY_mysys;
|
||||||
@ -108,7 +119,9 @@ my_bool my_thread_init(void)
|
|||||||
tmp->id= ++thread_id;
|
tmp->id= ++thread_id;
|
||||||
pthread_mutex_init(&tmp->mutex,NULL);
|
pthread_mutex_init(&tmp->mutex,NULL);
|
||||||
pthread_cond_init(&tmp->suspend, NULL);
|
pthread_cond_init(&tmp->suspend, NULL);
|
||||||
|
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
|
||||||
pthread_mutex_unlock(&THR_LOCK_lock);
|
pthread_mutex_unlock(&THR_LOCK_lock);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,13 +48,13 @@ static pthread_handler_decl(pthread_start,param)
|
|||||||
{
|
{
|
||||||
pthread_handler func=((struct pthread_map *) param)->func;
|
pthread_handler func=((struct pthread_map *) param)->func;
|
||||||
void *func_param=((struct pthread_map *) param)->param;
|
void *func_param=((struct pthread_map *) param)->param;
|
||||||
my_thread_init();
|
my_thread_init(); /* Will always succeed in windows */
|
||||||
pthread_mutex_lock(&THR_LOCK_thread); /* Wait for beingthread to return */
|
pthread_mutex_lock(&THR_LOCK_thread); /* Wait for beginthread to return */
|
||||||
win_pthread_self=((struct pthread_map *) param)->pthreadself;
|
win_pthread_self=((struct pthread_map *) param)->pthreadself;
|
||||||
pthread_mutex_unlock(&THR_LOCK_thread);
|
pthread_mutex_unlock(&THR_LOCK_thread);
|
||||||
free((char*) param);
|
free((char*) param); /* Free param from create */
|
||||||
pthread_exit((*func)(func_param));
|
pthread_exit((*func)(func_param));
|
||||||
return 0;
|
return 0; /* Safety */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,9 +218,8 @@ int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line)
|
|||||||
pthread_mutex_destroy(&mp->global);
|
pthread_mutex_destroy(&mp->global);
|
||||||
pthread_mutex_destroy(&mp->mutex);
|
pthread_mutex_destroy(&mp->mutex);
|
||||||
#else
|
#else
|
||||||
if (pthread_mutex_destroy(&mp->global) ||
|
error= (int) (pthread_mutex_destroy(&mp->global) ||
|
||||||
pthread_mutex_destroy(&mp->mutex))
|
pthread_mutex_destroy(&mp->mutex));
|
||||||
error=1;
|
|
||||||
#endif
|
#endif
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -1872,9 +1872,6 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
|
|||||||
struct sockaddr_in cAddr;
|
struct sockaddr_in cAddr;
|
||||||
int ip_flags=0,socket_flags=0,flags;
|
int ip_flags=0,socket_flags=0,flags;
|
||||||
Vio *vio_tmp;
|
Vio *vio_tmp;
|
||||||
#ifdef __WIN__
|
|
||||||
my_thread_init();
|
|
||||||
#endif
|
|
||||||
DBUG_ENTER("handle_connections_sockets");
|
DBUG_ENTER("handle_connections_sockets");
|
||||||
|
|
||||||
LINT_INIT(new_sock);
|
LINT_INIT(new_sock);
|
||||||
|
@ -1024,7 +1024,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||||||
strmov(new_name_buff,new_name);
|
strmov(new_name_buff,new_name);
|
||||||
fn_same(new_name_buff,table_name,3);
|
fn_same(new_name_buff,table_name,3);
|
||||||
#ifdef FN_LOWER_CASE
|
#ifdef FN_LOWER_CASE
|
||||||
if (!strcasecmp(new_name_buff,table_name)) // Check if name changed
|
if (!my_strcasecmp(new_name_buff,table_name))// Check if name changed
|
||||||
#else
|
#else
|
||||||
if (!strcmp(new_name_buff,table_name)) // Check if name changed
|
if (!strcmp(new_name_buff,table_name)) // Check if name changed
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,7 +24,8 @@ EXTRA_DIST = mysql.spec.sh \
|
|||||||
my-huge.cnf.sh \
|
my-huge.cnf.sh \
|
||||||
mysql-log-rotate.sh \
|
mysql-log-rotate.sh \
|
||||||
mysql.server.sh \
|
mysql.server.sh \
|
||||||
binary-configure.sh
|
binary-configure.sh \
|
||||||
|
magic
|
||||||
|
|
||||||
pkgdata_DATA = my-small.cnf \
|
pkgdata_DATA = my-small.cnf \
|
||||||
my-medium.cnf \
|
my-medium.cnf \
|
||||||
|
14
support-files/magic
Normal file
14
support-files/magic
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#
|
||||||
|
# Add the following to the end of your /etc/magic file to get the 'file'
|
||||||
|
# command to recognize some MySQL files.
|
||||||
|
#
|
||||||
|
0 beshort 0xfe01 MySQL table definition file
|
||||||
|
>2 byte x Version %d
|
||||||
|
0 belong&0xffffff00 0xfefe0300 MySQL MISAM index file
|
||||||
|
>3 byte x Version %d
|
||||||
|
0 belong&0xffffff00 0xfefe0700 MySQL MISAM compressed data file
|
||||||
|
>3 byte x Version %d
|
||||||
|
0 belong&0xffffff00 0xfefe0500 MySQL ISAM index file
|
||||||
|
>3 byte x Version %d
|
||||||
|
0 belong&0xffffff00 0xfefe0600 MySQL ISAM compressed data file
|
||||||
|
>3 byte x Version %d
|
Loading…
x
Reference in New Issue
Block a user