Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
b1dba93c
Commit
b1dba93c
authored
Oct 16, 2003
by
monty@mashka.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Safety fix to detect multiple calls to my_thread_end()
Portability fix (For Mac OS X)
parent
3414cf2e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
31 deletions
+56
-31
configure.in
configure.in
+1
-1
include/my_pthread.h
include/my_pthread.h
+1
-0
libmysqld/lib_sql.cc
libmysqld/lib_sql.cc
+0
-5
mysys/charset.c
mysys/charset.c
+43
-23
mysys/my_thr_init.c
mysys/my_thr_init.c
+7
-2
sql/sql_test.cc
sql/sql_test.cc
+4
-0
No files found.
configure.in
View file @
b1dba93c
...
@@ -733,7 +733,7 @@ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
...
@@ -733,7 +733,7 @@ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h
\
strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h
\
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h
\
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h
\
unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h
\
unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h
\
sys/ioctl.h
)
sys/ioctl.h
malloc.h sys/malloc.h
)
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# Check for system libraries. Adds the library to $LIBS
# Check for system libraries. Adds the library to $LIBS
...
...
include/my_pthread.h
View file @
b1dba93c
...
@@ -637,6 +637,7 @@ struct st_my_thread_var
...
@@ -637,6 +637,7 @@ struct st_my_thread_var
long
id
;
long
id
;
int
cmp_length
;
int
cmp_length
;
int
volatile
abort
;
int
volatile
abort
;
my_bool
init
;
#ifndef DBUG_OFF
#ifndef DBUG_OFF
gptr
dbug
;
gptr
dbug
;
char
name
[
THREAD_NAME_SIZE
+
1
];
char
name
[
THREAD_NAME_SIZE
+
1
];
...
...
libmysqld/lib_sql.cc
View file @
b1dba93c
...
@@ -621,11 +621,6 @@ void STDCALL mysql_server_end()
...
@@ -621,11 +621,6 @@ void STDCALL mysql_server_end()
my_free
((
char
*
)
copy_arguments_ptr
,
MYF
(
MY_ALLOW_ZERO_PTR
));
my_free
((
char
*
)
copy_arguments_ptr
,
MYF
(
MY_ALLOW_ZERO_PTR
));
copy_arguments_ptr
=
0
;
copy_arguments_ptr
=
0
;
clean_up
(
0
);
clean_up
(
0
);
#ifdef THREAD
/* Don't call my_thread_end() if the application is using MY_INIT() */
if
(
!
org_my_init_done
)
my_thread_end
();
#endif
/* If library called my_init(), free memory allocated by it */
/* If library called my_init(), free memory allocated by it */
if
(
!
org_my_init_done
)
if
(
!
org_my_init_done
)
my_end
(
0
);
my_end
(
0
);
...
...
mysys/charset.c
View file @
b1dba93c
...
@@ -453,20 +453,37 @@ static my_bool charset_in_string(const char *name, DYNAMIC_STRING *s)
...
@@ -453,20 +453,37 @@ static my_bool charset_in_string(const char *name, DYNAMIC_STRING *s)
static
void
charset_append
(
DYNAMIC_STRING
*
s
,
const
char
*
name
)
static
void
charset_append
(
DYNAMIC_STRING
*
s
,
const
char
*
name
)
{
{
if
(
!
charset_in_string
(
name
,
s
))
{
if
(
!
charset_in_string
(
name
,
s
))
{
dynstr_append
(
s
,
name
);
dynstr_append
(
s
,
name
);
dynstr_append
(
s
,
" "
);
dynstr_append
(
s
,
" "
);
}
}
}
}
/* Returns a dynamically-allocated string listing the character sets
/*
requested. The caller is responsible for freeing the memory. */
Returns a dynamically-allocated string listing the character sets
requested.
SYNOPSIS
list_charsets()
want_flags Flags for which character sets to return:
MY_COMPILED_SETS: Return incompiled charsets
MY_INDEX_SETS:
MY_LOADED_SETS:
NOTES
The caller is responsible for freeing the memory.
RETURN
A string with available character sets separated by space
*/
char
*
list_charsets
(
myf
want_flags
)
char
*
list_charsets
(
myf
want_flags
)
{
{
DYNAMIC_STRING
s
;
DYNAMIC_STRING
s
;
char
*
p
;
char
*
result
;
(
void
)
init_available_charsets
(
MYF
(
0
));
(
void
)
init_available_charsets
(
MYF
(
0
));
init_dynamic_string
(
&
s
,
NullS
,
256
,
1024
);
init_dynamic_string
(
&
s
,
NullS
,
256
,
1024
);
...
@@ -483,42 +500,45 @@ char * list_charsets(myf want_flags)
...
@@ -483,42 +500,45 @@ char * list_charsets(myf want_flags)
if
(
want_flags
&
MY_CONFIG_SETS
)
if
(
want_flags
&
MY_CONFIG_SETS
)
{
{
CS_ID
**
c
;
CS_ID
**
c
harset
;
char
buf
[
FN_REFLEN
];
char
buf
[
FN_REFLEN
];
MY_STAT
status
;
MY_STAT
status
;
if
((
c
=
available_charsets
))
if
((
charset
=
available_charsets
))
for
(;
*
c
;
++
c
)
{
{
for
(;
*
charset
;
charset
++
)
if
(
charset_in_string
((
*
c
)
->
name
,
&
s
))
{
continue
;
if
(
charset_in_string
((
*
charset
)
->
name
,
&
s
))
get_charset_conf_name
((
*
c
)
->
number
,
buf
);
continue
;
if
(
!
my_stat
(
buf
,
&
status
,
MYF
(
0
)))
get_charset_conf_name
((
*
charset
)
->
number
,
buf
);
continue
;
/* conf file doesn't exist */
if
(
!
my_stat
(
buf
,
&
status
,
MYF
(
0
)))
dynstr_append
(
&
s
,
(
*
c
)
->
name
);
continue
;
/* conf file doesn't exist */
dynstr_append
(
&
s
,
" "
);
dynstr_append
(
&
s
,
(
*
charset
)
->
name
);
}
dynstr_append
(
&
s
,
" "
);
}
}
}
}
if
(
want_flags
&
MY_INDEX_SETS
)
if
(
want_flags
&
MY_INDEX_SETS
)
{
{
CS_ID
**
c
;
CS_ID
**
c
harset
;
for
(
c
=
available_charsets
;
*
c
;
++
c
)
for
(
c
harset
=
available_charsets
;
*
charset
;
charset
++
)
charset_append
(
&
s
,
(
*
c
)
->
name
);
charset_append
(
&
s
,
(
*
c
harset
)
->
name
);
}
}
if
(
want_flags
&
MY_LOADED_SETS
)
if
(
want_flags
&
MY_LOADED_SETS
)
{
{
uint
i
;
uint
i
;
for
(
i
=
0
;
i
<
cs_info_table
.
elements
;
i
++
)
for
(
i
=
0
;
i
<
cs_info_table
.
elements
;
i
++
)
charset_append
(
&
s
,
charset_append
(
&
s
,
dynamic_element
(
&
cs_info_table
,
i
,
CHARSET_INFO
*
)
->
name
);
dynamic_element
(
&
cs_info_table
,
i
,
CHARSET_INFO
*
)
->
name
);
}
}
s
.
str
[
s
.
length
-
1
]
=
'\0'
;
/* chop trailing space */
if
(
s
.
length
)
p
=
my_strdup
(
s
.
str
,
MYF
(
MY_WME
));
s
.
length
--
;
/* Remove end space */
result
=
my_strdup_with_length
(
s
.
str
,
s
.
length
,
MYF
(
MY_WME
));
dynstr_free
(
&
s
);
dynstr_free
(
&
s
);
return
p
;
return
result
;
}
}
/****************************************************************************
/****************************************************************************
...
...
mysys/my_thr_init.c
View file @
b1dba93c
...
@@ -159,6 +159,7 @@ my_bool my_thread_init(void)
...
@@ -159,6 +159,7 @@ my_bool my_thread_init(void)
tmp
->
id
=
++
thread_id
;
tmp
->
id
=
++
thread_id
;
pthread_mutex_init
(
&
tmp
->
mutex
,
MY_MUTEX_INIT_FAST
);
pthread_mutex_init
(
&
tmp
->
mutex
,
MY_MUTEX_INIT_FAST
);
pthread_cond_init
(
&
tmp
->
suspend
,
NULL
);
pthread_cond_init
(
&
tmp
->
suspend
,
NULL
);
tmp
->
init
=
1
;
end:
end:
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
...
@@ -170,12 +171,14 @@ end:
...
@@ -170,12 +171,14 @@ end:
void
my_thread_end
(
void
)
void
my_thread_end
(
void
)
{
{
struct
st_my_thread_var
*
tmp
=
my_thread_var
;
struct
st_my_thread_var
*
tmp
;
tmp
=
my_pthread_getspecific
(
struct
st_my_thread_var
*
,
THR_KEY_mysys
);
#ifdef EXTRA_DEBUG_THREADS
#ifdef EXTRA_DEBUG_THREADS
fprintf
(
stderr
,
"my_thread_end(): tmp=%p,thread_id=%ld
\n
"
,
fprintf
(
stderr
,
"my_thread_end(): tmp=%p,thread_id=%ld
\n
"
,
tmp
,
pthread_self
());
tmp
,
pthread_self
());
#endif
#endif
if
(
tmp
)
if
(
tmp
&&
tmp
->
init
)
{
{
#if !defined(DBUG_OFF)
#if !defined(DBUG_OFF)
/* tmp->dbug is allocated inside DBUG library */
/* tmp->dbug is allocated inside DBUG library */
...
@@ -191,6 +194,8 @@ void my_thread_end(void)
...
@@ -191,6 +194,8 @@ void my_thread_end(void)
pthread_mutex_destroy
(
&
tmp
->
mutex
);
pthread_mutex_destroy
(
&
tmp
->
mutex
);
#if (!defined(__WIN__) && !defined(OS2)) || defined(USE_TLS)
#if (!defined(__WIN__) && !defined(OS2)) || defined(USE_TLS)
free
(
tmp
);
free
(
tmp
);
#else
tmp
->
init
=
0
;
#endif
#endif
}
}
/* The following free has to be done, even if my_thread_var() is 0 */
/* The following free has to be done, even if my_thread_var() is 0 */
...
...
sql/sql_test.cc
View file @
b1dba93c
...
@@ -22,7 +22,11 @@
...
@@ -22,7 +22,11 @@
#include "sql_select.h"
#include "sql_select.h"
#include <hash.h>
#include <hash.h>
#include <thr_alarm.h>
#include <thr_alarm.h>
#if defined(HAVE_MALLINFO) && defined(HAVE_MALLOC_H)
#include <malloc.h>
#include <malloc.h>
#elif defined(HAVE_MALLINFO) && defined(HAVE_SYS_MALLOC_H)
#include <sys/malloc.h>
#endif
/* Intern key cache variables */
/* Intern key cache variables */
extern
"C"
pthread_mutex_t
THR_LOCK_keycache
;
extern
"C"
pthread_mutex_t
THR_LOCK_keycache
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment