mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
Fix for SAFE_MUTEX on windows
This commit is contained in:
parent
2780278f35
commit
830d308960
9 changed files with 46 additions and 21 deletions
|
@ -1385,14 +1385,14 @@ and PHP's @strong{MySQL}-related functions
|
|||
@item Price @tab $34.95
|
||||
@end multitable
|
||||
|
||||
This book teaches you how to use @strong{MySQL} and @code{mSQL}, two popular and
|
||||
robust database products that support key subsets of SQL on both Linux
|
||||
and UNIX systems. Anyone who knows basic C, Java, Perl, or Python can
|
||||
write a program to interact with a database, either as a stand-alone
|
||||
application or through a Web page. This book takes you through the
|
||||
whole process, from installation and configuration to programming
|
||||
interfaces and basic administration. Includes ample tutorial
|
||||
material.
|
||||
This book teaches you how to use @strong{MySQL} and @code{mSQL}, two
|
||||
popular and robust database products that support key subsets of SQL on
|
||||
both Linux and UNIX systems. Anyone who knows basic C, Java, Perl, or
|
||||
Python can write a program to interact with a database, either as a
|
||||
stand-alone application or through a Web page. This book takes you
|
||||
through the whole process, from installation and configuration to
|
||||
programming interfaces and basic administration. Includes ample
|
||||
tutorial material.
|
||||
|
||||
@multitable @columnfractions .3 .7
|
||||
@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
|
||||
|
||||
#ifdef USE_TLS /* For LIBMYSQL.DLL */
|
||||
#undef SAFE_MUTEX /* This will cause conflicts */
|
||||
#define pthread_key(T,V) DWORD V
|
||||
#define pthread_key_create(A,B) ((*A=TlsAlloc())==0xFFFFFFFF)
|
||||
#define pthread_getspecific(A) (TlsGetValue(A))
|
||||
|
|
|
@ -77,10 +77,19 @@ void my_thread_global_end(void)
|
|||
|
||||
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)
|
||||
{
|
||||
struct st_my_thread_var *tmp;
|
||||
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
|
||||
pthread_mutex_lock(&THR_LOCK_lock);
|
||||
#endif
|
||||
#if !defined(__WIN__) || defined(USE_TLS)
|
||||
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);
|
||||
|
||||
#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);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
tmp= &THR_KEY_mysys;
|
||||
|
@ -108,7 +119,9 @@ my_bool my_thread_init(void)
|
|||
tmp->id= ++thread_id;
|
||||
pthread_mutex_init(&tmp->mutex,NULL);
|
||||
pthread_cond_init(&tmp->suspend, NULL);
|
||||
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
|
||||
pthread_mutex_unlock(&THR_LOCK_lock);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,13 +48,13 @@ static pthread_handler_decl(pthread_start,param)
|
|||
{
|
||||
pthread_handler func=((struct pthread_map *) param)->func;
|
||||
void *func_param=((struct pthread_map *) param)->param;
|
||||
my_thread_init();
|
||||
pthread_mutex_lock(&THR_LOCK_thread); /* Wait for beingthread to return */
|
||||
my_thread_init(); /* Will always succeed in windows */
|
||||
pthread_mutex_lock(&THR_LOCK_thread); /* Wait for beginthread to return */
|
||||
win_pthread_self=((struct pthread_map *) param)->pthreadself;
|
||||
pthread_mutex_unlock(&THR_LOCK_thread);
|
||||
free((char*) param);
|
||||
free((char*) param); /* Free param from create */
|
||||
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->mutex);
|
||||
#else
|
||||
if (pthread_mutex_destroy(&mp->global) ||
|
||||
pthread_mutex_destroy(&mp->mutex))
|
||||
error=1;
|
||||
error= (int) (pthread_mutex_destroy(&mp->global) ||
|
||||
pthread_mutex_destroy(&mp->mutex));
|
||||
#endif
|
||||
return error;
|
||||
}
|
||||
|
|
|
@ -1872,9 +1872,6 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
|
|||
struct sockaddr_in cAddr;
|
||||
int ip_flags=0,socket_flags=0,flags;
|
||||
Vio *vio_tmp;
|
||||
#ifdef __WIN__
|
||||
my_thread_init();
|
||||
#endif
|
||||
DBUG_ENTER("handle_connections_sockets");
|
||||
|
||||
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);
|
||||
fn_same(new_name_buff,table_name,3);
|
||||
#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
|
||||
if (!strcmp(new_name_buff,table_name)) // Check if name changed
|
||||
#endif
|
||||
|
|
|
@ -24,7 +24,8 @@ EXTRA_DIST = mysql.spec.sh \
|
|||
my-huge.cnf.sh \
|
||||
mysql-log-rotate.sh \
|
||||
mysql.server.sh \
|
||||
binary-configure.sh
|
||||
binary-configure.sh \
|
||||
magic
|
||||
|
||||
pkgdata_DATA = my-small.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…
Reference in a new issue