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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
496d0d78
Commit
496d0d78
authored
Feb 08, 2007
by
tsmith@siva.hindu.god
Browse files
Options
Browse Files
Download
Plain Diff
Merge siva.hindu.god:/home/tsmith/m/bk/40
into siva.hindu.god:/home/tsmith/m/bk/maint/40
parents
eec44018
0e9a6468
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
228 additions
and
152 deletions
+228
-152
BUILD/SETUP.sh
BUILD/SETUP.sh
+2
-2
configure.in
configure.in
+98
-61
include/my_global.h
include/my_global.h
+1
-1
include/my_pthread.h
include/my_pthread.h
+32
-10
include/thr_alarm.h
include/thr_alarm.h
+2
-5
mysys/default.c
mysys/default.c
+2
-2
mysys/my_pthread.c
mysys/my_pthread.c
+6
-1
mysys/my_thr_init.c
mysys/my_thr_init.c
+25
-0
mysys/thr_alarm.c
mysys/thr_alarm.c
+42
-51
sql/mysqld.cc
sql/mysqld.cc
+18
-19
No files found.
BUILD/SETUP.sh
View file @
496d0d78
...
@@ -39,8 +39,8 @@ global_warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wch
...
@@ -39,8 +39,8 @@ global_warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wch
c_warnings
=
"
$global_warnings
-Wunused"
c_warnings
=
"
$global_warnings
-Wunused"
cxx_warnings
=
"
$global_warnings
-Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
cxx_warnings
=
"
$global_warnings
-Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
alpha_cflags
=
"-mcpu=ev6 -Wa,-mev6"
# Not used yet
#
alpha_cflags="-mcpu=ev6 -Wa,-mev6" # Not used yet
pentium_cflags
=
"-mcpu=pentiumpro"
#
pentium_cflags="-mcpu=pentiumpro"
sparc_cflags
=
""
sparc_cflags
=
""
# be as fast as we can be without losing our ability to backtrace
# be as fast as we can be without losing our ability to backtrace
...
...
configure.in
View file @
496d0d78
...
@@ -388,15 +388,16 @@ AC_MSG_CHECKING("if we should use 'skip-locking' as default for $target_os")
...
@@ -388,15 +388,16 @@ AC_MSG_CHECKING("if we should use 'skip-locking' as default for $target_os")
if
expr
"
$target_os
"
:
"[[Ll]]inux.*"
>
/dev/null
if
expr
"
$target_os
"
:
"[[Ll]]inux.*"
>
/dev/null
then
then
MYSQLD_DEFAULT_SWITCHES
=
"--skip-locking"
MYSQLD_DEFAULT_SWITCHES
=
"--skip-locking"
IS
_LINUX
=
"true"
TARGET
_LINUX
=
"true"
AC_MSG_RESULT
(
"yes"
)
;
AC_MSG_RESULT
(
"yes"
)
;
AC_DEFINE
([
TARGET_OS_LINUX],
[
1],
[
Whether we build
for
Linux]
)
else
else
MYSQLD_DEFAULT_SWITCHES
=
""
MYSQLD_DEFAULT_SWITCHES
=
""
IS
_LINUX
=
"false"
TARGET
_LINUX
=
"false"
AC_MSG_RESULT
(
"no"
)
;
AC_MSG_RESULT
(
"no"
)
;
fi
fi
AC_SUBST
(
MYSQLD_DEFAULT_SWITCHES
)
AC_SUBST
(
MYSQLD_DEFAULT_SWITCHES
)
AC_SUBST
(
IS
_LINUX
)
AC_SUBST
(
TARGET
_LINUX
)
dnl Find paths to some shell programs
dnl Find paths to some shell programs
AC_PATH_PROG
(
LN,
ln
,
ln
)
AC_PATH_PROG
(
LN,
ln
,
ln
)
...
@@ -576,7 +577,7 @@ AC_SUBST(NOINST_LDFLAGS)
...
@@ -576,7 +577,7 @@ AC_SUBST(NOINST_LDFLAGS)
# (this is true on the MySQL build machines to avoid NSS problems)
# (this is true on the MySQL build machines to avoid NSS problems)
#
#
if
test
"
$
IS
_LINUX
"
=
"true"
-a
"
$static_nss
"
=
""
if
test
"
$
TARGET
_LINUX
"
=
"true"
-a
"
$static_nss
"
=
""
then
then
tmp
=
`
nm /usr/lib/libc.a |
grep
_nss_files_getaliasent_r
`
tmp
=
`
nm /usr/lib/libc.a |
grep
_nss_files_getaliasent_r
`
if
test
-n
"
$tmp
"
if
test
-n
"
$tmp
"
...
@@ -827,7 +828,7 @@ struct request_info *req;
...
@@ -827,7 +828,7 @@ struct request_info *req;
])
])
AC_SUBST
(
WRAPLIBS
)
AC_SUBST
(
WRAPLIBS
)
if
test
"
$
IS
_LINUX
"
=
"true"
;
then
if
test
"
$
TARGET
_LINUX
"
=
"true"
;
then
AC_MSG_CHECKING
([
for
atomic operations]
)
AC_MSG_CHECKING
([
for
atomic operations]
)
AC_LANG_SAVE
AC_LANG_SAVE
...
@@ -870,7 +871,7 @@ int main()
...
@@ -870,7 +871,7 @@ int main()
[
USE_PSTACK
=
no
])
[
USE_PSTACK
=
no
])
pstack_libs
=
pstack_libs
=
pstack_dirs
=
pstack_dirs
=
if
test
"
$USE_PSTACK
"
=
yes
-a
"
$
IS
_LINUX
"
=
"true"
-a
"
$BASE_MACHINE_TYPE
"
=
"i386"
-a
"
$with_mit_threads
"
=
"no"
if
test
"
$USE_PSTACK
"
=
yes
-a
"
$
TARGET
_LINUX
"
=
"true"
-a
"
$BASE_MACHINE_TYPE
"
=
"i386"
-a
"
$with_mit_threads
"
=
"no"
then
then
have_libiberty
=
have_libbfd
=
have_libiberty
=
have_libbfd
=
my_save_LIBS
=
"
$LIBS
"
my_save_LIBS
=
"
$LIBS
"
...
@@ -1239,63 +1240,98 @@ with_posix_threads="no"
...
@@ -1239,63 +1240,98 @@ with_posix_threads="no"
# Hack for DEC-UNIX (OSF1)
# Hack for DEC-UNIX (OSF1)
if
test
"
$with_named_thread
"
=
"no"
-a
"
$with_mit_threads
"
=
"no"
if
test
"
$with_named_thread
"
=
"no"
-a
"
$with_mit_threads
"
=
"no"
then
then
# Look for LinuxThreads.
AC_MSG_CHECKING
(
"Linux threads"
)
AC_MSG_CHECKING
(
"LinuxThreads"
)
if
test
"
$TARGET_LINUX
"
=
"true"
grepres
=
`
grep
Linuxthreads /usr/include/pthread.h 2>/dev/null |
wc
-l
`
getconfres
=
`
which getconf
>
/dev/null
&&
getconf GNU_LIBPTHREAD_VERSION |
tr
abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |grep LINUXTHREADS |
wc
-l
||
echo
0
`
if
test
"
$grepres
"
-gt
0
-o
"
$getconfres
"
-gt
0
then
then
AC_MSG_RESULT
(
"Found"
)
AC_MSG_RESULT
(
"starting"
)
AC_DEFINE
(
HAVE_LINUXTHREADS
)
# use getconf to check glibc contents
# Linux 2.0 sanity check
AC_MSG_CHECKING
(
"getconf GNU_LIBPTHREAD_VERSION"
)
AC_TRY_COMPILE
([
#include <sched.h>], [int a = sched_get_priority_min(1);], ,
case
`
getconf GNU_LIBPTHREAD_VERSION |
tr
abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
`
in
AC_MSG_ERROR
([
Syntax error
in
sched.h. Change _P to __P
in
the /usr/include/sched.h file. See the Installation chapter
in
the Reference Manual]
))
NPTL
*
)
# RedHat 5.0 does not work with dynamic linking of this. -static also
AC_MSG_RESULT
(
"NPTL"
)
# gives a speed increase in linux so it does not hurt on other systems.
AC_DEFINE
([
HAVE_NPTL],
[
1],
[
NPTL threads implementation]
)
with_named_thread
=
"-lpthread"
with_named_thread
=
"-lpthread"
else
;;
AC_MSG_RESULT
(
"Not found"
)
LINUXTHREADS
*
)
# If this is a linux machine we should barf
AC_MSG_RESULT
(
"Linuxthreads"
)
AC_MSG_CHECKING
(
"NPTL"
)
AC_DEFINE
([
HAVE_LINUXTHREADS],
[
1],
if
test
"
$IS_LINUX
"
=
"true"
[
Whether we are using Xavier Leroy
's LinuxThreads])
then
with_named_thread="-lpthread"
getconfres
=
`
which getconf
>
/dev/null
&&
getconf GNU_LIBPTHREAD_VERSION |
tr
abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |grep NPTL |
wc
-l
||
echo
0
`
;;
if
test
"
$getconfres
"
-gt
0
* )
AC_MSG_RESULT("unknown")
;;
esac
if test "$with_named_thread" = "no"
then
then
AC_DEFINE
(
HAVE_LINUXTHREADS
)
dnl All this code predates NPTL, so
"have linuxthreads"
is a poor name.
# old method, check headers
with_named_thread
=
"-lpthread"
# Look for LinuxThreads.
AC_MSG_CHECKING("LinuxThreads in header file comment")
res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
if test "$res" -gt 0
then
AC_MSG_RESULT("Found")
AC_DEFINE([HAVE_LINUXTHREADS], [1],
[Whether we are using Xavier Leroy'
s LinuxThreads]
)
# Linux 2.0 sanity check
AC_TRY_COMPILE
([
#include <sched.h>], [int a = sched_get_priority_min(1);], ,
AC_MSG_ERROR
([
Syntax error
in
sched.h. Change _P to __P
in
the /usr/include/sched.h file. See the Installation chapter
in
the Reference Manual]
))
# RedHat 5.0 does not work with dynamic linking of this. -static also
# gives a speed increase in linux so it does not hurt on other systems.
with_named_thread
=
"-lpthread"
else
AC_MSG_RESULT
(
"Not found"
)
# If this is a linux machine we should barf
AC_MSG_ERROR
([
This is a Linux system without a working getconf,
and Linuxthreads was not found. Please
install
it
(
or a new glibc
)
and try again.
See the Installation chapter
in
the Reference Manual
for
more information.]
)
fi
else
else
AC_MSG_ERROR
([
This is a Linux system and neither Linuxthreads nor NPTL were
AC_MSG_RESULT
(
"no need to check headers"
)
found. Please
install
Linuxthreads or a new glibc and try
again. See the Installation chapter
in
the Reference Manual
for
more information.]
)
fi
fi
else
AC_MSG_CHECKING
(
"for pthread_create in -lpthread"
)
;
AC_MSG_CHECKING
(
"DEC threads"
)
ac_save_LIBS
=
"
$LIBS
"
if
test
-f
/usr/shlib/libpthread.so
-a
-f
/usr/lib/libmach.a
-a
-f
/usr/ccs/lib/cmplrs/cc/libexc.a
LIBS
=
"
$LIBS
-lpthread"
then
AC_TRY_LINK
(
[
#include <pthread.h>],
with_named_thread
=
"-lpthread -lmach -lexc"
[
(
void
)
pthread_create
((
pthread_t
*
)
0,
(
pthread_attr_t
*
)
0, 0, 0
)
;
]
,
CFLAGS
=
"
$CFLAGS
-D_REENTRANT"
AC_MSG_RESULT
(
"yes"
)
,
CXXFLAGS
=
"
$CXXFLAGS
-D_REENTRANT"
[
AC_MSG_RESULT
(
"no"
)
AC_DEFINE
(
HAVE_DEC_THREADS
)
AC_MSG_ERROR
([
AC_MSG_RESULT
(
"yes"
)
This is a Linux system claiming to support threads, either Linuxthreads or NPTL, but linking a
test
program failed.
else
Please
install
one of these
(
or a new glibc
)
and try again.
AC_MSG_RESULT
(
"no"
)
See the Installation chapter
in
the Reference Manual
for
more information.]
)
]
AC_MSG_CHECKING
(
"DEC 3.2 threads"
)
)
if
test
-f
/usr/shlib/libpthreads.so
-a
-f
/usr/lib/libmach.a
-a
-f
/usr/ccs/lib/cmplrs/cc/libexc.a
LIBS
=
"
$ac_save_LIBS
"
then
else
with_named_thread
=
"-lpthreads -lmach -lc_r"
AC_MSG_RESULT
(
"no"
)
AC_DEFINE
(
HAVE_DEC_THREADS
)
fi
# "$TARGET_LINUX"
AC_DEFINE
(
HAVE_DEC_3_2_THREADS
)
fi
# "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
with_osf32_threads
=
"yes"
MYSQLD_DEFAULT_SWITCHES
=
"--skip-thread-priority"
if
test
"
$with_named_thread
"
=
"no"
-a
"
$with_mit_threads
"
=
"no"
AC_MSG_RESULT
(
"yes"
)
then
else
AC_MSG_CHECKING
(
"DEC threads"
)
AC_MSG_RESULT
(
"no"
)
if
test
-f
/usr/shlib/libpthread.so
-a
-f
/usr/lib/libmach.a
-a
-f
/usr/ccs/lib/cmplrs/cc/libexc.a
fi
then
fi
with_named_thread
=
"-lpthread -lmach -lexc"
fi
CFLAGS
=
"
$CFLAGS
-D_REENTRANT"
fi
CXXFLAGS
=
"
$CXXFLAGS
-D_REENTRANT"
AC_DEFINE
(
HAVE_DEC_THREADS
)
AC_MSG_RESULT
(
"yes"
)
else
AC_MSG_RESULT
(
"no"
)
AC_MSG_CHECKING
(
"DEC 3.2 threads"
)
if
test
-f
/usr/shlib/libpthreads.so
-a
-f
/usr/lib/libmach.a
-a
-f
/usr/ccs/lib/cmplrs/cc/libexc.a
then
with_named_thread
=
"-lpthreads -lmach -lc_r"
AC_DEFINE
(
HAVE_DEC_THREADS
)
AC_DEFINE
(
HAVE_DEC_3_2_THREADS
)
with_osf32_threads
=
"yes"
MYSQLD_DEFAULT_SWITCHES
=
"--skip-thread-priority"
AC_MSG_RESULT
(
"yes"
)
else
AC_MSG_RESULT
(
"no"
)
fi
fi
fi
fi
...
@@ -1720,7 +1756,7 @@ fi
...
@@ -1720,7 +1756,7 @@ fi
AC_SUBST
(
COMPILATION_COMMENT
)
AC_SUBST
(
COMPILATION_COMMENT
)
AC_MSG_CHECKING
(
"need of special linking flags"
)
AC_MSG_CHECKING
(
"need of special linking flags"
)
if
test
"
$
IS
_LINUX
"
=
"true"
-a
"
$ac_cv_prog_gcc
"
=
"yes"
-a
"
$all_is_static
"
!=
"yes"
if
test
"
$
TARGET
_LINUX
"
=
"true"
-a
"
$ac_cv_prog_gcc
"
=
"yes"
-a
"
$all_is_static
"
!=
"yes"
then
then
LDFLAGS
=
"
$LDFLAGS
-rdynamic"
LDFLAGS
=
"
$LDFLAGS
-rdynamic"
AC_MSG_RESULT
(
"-rdynamic"
)
AC_MSG_RESULT
(
"-rdynamic"
)
...
@@ -1873,6 +1909,7 @@ AC_CHECK_FUNCS(alarm bmove \
...
@@ -1873,6 +1909,7 @@ AC_CHECK_FUNCS(alarm bmove \
tell atod memcpy memmove
\
tell atod memcpy memmove
\
setupterm strcasecmp sighold vidattr lrand48 localtime_r
\
setupterm strcasecmp sighold vidattr lrand48 localtime_r
\
sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np
\
sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np
\
sigaction sigemptyset sigaddset
\
pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam
\
pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam
\
pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize
\
pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize
\
pthread_attr_getstacksize pthread_key_delete
\
pthread_attr_getstacksize pthread_key_delete
\
...
@@ -1884,7 +1921,7 @@ CFLAGS="$ORG_CFLAGS"
...
@@ -1884,7 +1921,7 @@ CFLAGS="$ORG_CFLAGS"
# Sanity check: We chould not have any fseeko symbol unless
# Sanity check: We chould not have any fseeko symbol unless
# large_file_support=yes
# large_file_support=yes
AC_CHECK_FUNCS
(
fseeko,
AC_CHECK_FUNCS
(
fseeko,
[
if
test
"
$large_file_support
"
=
no
-a
"
$
IS
_LINUX
"
=
"true"
;
[
if
test
"
$large_file_support
"
=
no
-a
"
$
TARGET
_LINUX
"
=
"true"
;
then
then
AC_MSG_ERROR
(
"Found fseeko symbol but large_file_support is not enabled!"
)
;
AC_MSG_ERROR
(
"Found fseeko symbol but large_file_support is not enabled!"
)
;
fi
]
fi
]
...
...
include/my_global.h
View file @
496d0d78
...
@@ -97,7 +97,7 @@
...
@@ -97,7 +97,7 @@
/* Fix problem with S_ISLNK() on Linux */
/* Fix problem with S_ISLNK() on Linux */
#if defined(
HAVE_LINUXTHREADS
)
#if defined(
TARGET_OS_LINUX) || defined(__GLIBC__
)
#undef _GNU_SOURCE
#undef _GNU_SOURCE
#define _GNU_SOURCE 1
#define _GNU_SOURCE 1
#endif
#endif
...
...
include/my_pthread.h
View file @
496d0d78
...
@@ -286,8 +286,8 @@ extern int my_pthread_create_detached;
...
@@ -286,8 +286,8 @@ extern int my_pthread_create_detached;
#undef HAVE_PTHREAD_RWLOCK_RDLOCK
#undef HAVE_PTHREAD_RWLOCK_RDLOCK
#undef HAVE_SNPRINTF
#undef HAVE_SNPRINTF
#define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
#define
my_
sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
#define signal(A,B) pthread_signal((A),(void (*)(int)) (B))
#define
my_
signal(A,B) pthread_signal((A),(void (*)(int)) (B))
#define my_pthread_attr_setprio(A,B)
#define my_pthread_attr_setprio(A,B)
#endif
/* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */
#endif
/* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */
...
@@ -324,14 +324,27 @@ extern int my_pthread_cond_init(pthread_cond_t *mp,
...
@@ -324,14 +324,27 @@ extern int my_pthread_cond_init(pthread_cond_t *mp,
#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX)
#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX)
int
sigwait
(
sigset_t
*
setp
,
int
*
sigp
);
/* Use our implemention */
int
sigwait
(
sigset_t
*
setp
,
int
*
sigp
);
/* Use our implemention */
#endif
#endif
#if !defined(HAVE_SIGSET) && !defined(HAVE_mit_thread) && !defined(sigset)
#define sigset(A,B) do { struct sigaction s; sigset_t set; \
/*
sigemptyset(&set); \
We define my_sigset() and use that instead of the system sigset() so that
s.sa_handler = (B); \
we can favor an implementation based on sigaction(). On some systems, such
s.sa_mask = set; \
as Mac OS X, sigset() results in flags such as SA_RESTART being set, and
s.sa_flags = 0; \
we want to make sure that no such flags are set.
sigaction((A), &s, (struct sigaction *) NULL); \
*/
#if defined(HAVE_SIGACTION) && !defined(my_sigset)
#define my_sigset(A,B) do { struct sigaction s; sigset_t set; int rc; \
DBUG_ASSERT((A) != 0); \
sigemptyset(&set); \
s.sa_handler = (B); \
s.sa_mask = set; \
s.sa_flags = 0; \
rc= sigaction((A), &s, (struct sigaction *) NULL); \
DBUG_ASSERT(rc == 0); \
} while (0)
} while (0)
#elif defined(HAVE_SIGSET) && !defined(my_sigset)
#define my_sigset(A,B) sigset((A),(B))
#elif !defined(my_sigset)
#define my_sigset(A,B) signal((A),(B))
#endif
#endif
#ifndef my_pthread_setprio
#ifndef my_pthread_setprio
...
@@ -416,7 +429,7 @@ struct tm *localtime_r(const time_t *clock, struct tm *res);
...
@@ -416,7 +429,7 @@ struct tm *localtime_r(const time_t *clock, struct tm *res);
#undef pthread_detach_this_thread
#undef pthread_detach_this_thread
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); }
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); }
#undef sigset
#undef sigset
#define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
#define
my_
sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
#endif
#endif
#if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER)
#if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER)
...
@@ -663,6 +676,15 @@ extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const));
...
@@ -663,6 +676,15 @@ extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const));
*/
*/
extern
pthread_t
shutdown_th
,
main_th
,
signal_th
;
extern
pthread_t
shutdown_th
,
main_th
,
signal_th
;
/* Which kind of thread library is in use */
#define THD_LIB_OTHER 1
#define THD_LIB_NPTL 2
#define THD_LIB_LT 4
extern
uint
thd_lib_detected
;
extern
uint
thr_client_alarm
;
/* statistics_xxx functions are for not essential statistic */
/* statistics_xxx functions are for not essential statistic */
#ifndef thread_safe_increment
#ifndef thread_safe_increment
...
...
include/thr_alarm.h
View file @
496d0d78
...
@@ -25,11 +25,6 @@ extern "C" {
...
@@ -25,11 +25,6 @@ extern "C" {
#ifndef USE_ALARM_THREAD
#ifndef USE_ALARM_THREAD
#define USE_ONE_SIGNAL_HAND
/* One must call process_alarm */
#define USE_ONE_SIGNAL_HAND
/* One must call process_alarm */
#endif
#endif
#ifdef HAVE_LINUXTHREADS
#define THR_CLIENT_ALARM SIGALRM
#else
#define THR_CLIENT_ALARM SIGUSR1
#endif
#ifdef HAVE_rts_threads
#ifdef HAVE_rts_threads
#undef USE_ONE_SIGNAL_HAND
#undef USE_ONE_SIGNAL_HAND
#define USE_ALARM_THREAD
#define USE_ALARM_THREAD
...
@@ -98,6 +93,8 @@ typedef struct st_alarm {
...
@@ -98,6 +93,8 @@ typedef struct st_alarm {
my_bool
malloced
;
my_bool
malloced
;
}
ALARM
;
}
ALARM
;
extern
uint
thr_client_alarm
;
#define thr_alarm_init(A) (*(A))=0
#define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A)!= 0)
#define thr_alarm_in_use(A) (*(A)!= 0)
void
init_thr_alarm
(
uint
max_alarm
);
void
init_thr_alarm
(
uint
max_alarm
);
...
...
mysys/default.c
View file @
496d0d78
...
@@ -282,7 +282,7 @@ static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
...
@@ -282,7 +282,7 @@ static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
{
{
char
**
ext
;
char
**
ext
;
for
(
ext
=
(
char
**
)
f_extensions
;
*
ext
;
*
ext
++
)
for
(
ext
=
(
char
**
)
f_extensions
;
*
ext
;
ext
++
)
{
{
int
error
;
int
error
;
if
((
error
=
search_default_file_with_ext
(
args
,
alloc
,
dir
,
*
ext
,
if
((
error
=
search_default_file_with_ext
(
args
,
alloc
,
dir
,
*
ext
,
...
@@ -543,7 +543,7 @@ void print_defaults(const char *conf_file, const char **groups)
...
@@ -543,7 +543,7 @@ void print_defaults(const char *conf_file, const char **groups)
#endif
#endif
for
(
dirs
=
default_directories
;
*
dirs
;
dirs
++
)
for
(
dirs
=
default_directories
;
*
dirs
;
dirs
++
)
{
{
for
(
ext
=
(
char
**
)
f_extensions
;
*
ext
;
*
ext
++
)
for
(
ext
=
(
char
**
)
f_extensions
;
*
ext
;
ext
++
)
{
{
const
char
*
pos
;
const
char
*
pos
;
char
*
end
;
char
*
end
;
...
...
mysys/my_pthread.c
View file @
496d0d78
...
@@ -31,6 +31,9 @@
...
@@ -31,6 +31,9 @@
#define SCHED_POLICY SCHED_OTHER
#define SCHED_POLICY SCHED_OTHER
#endif
#endif
uint
thd_lib_detected
;
uint
thr_client_alarm
;
#ifndef my_pthread_setprio
#ifndef my_pthread_setprio
void
my_pthread_setprio
(
pthread_t
thread_id
,
int
prior
)
void
my_pthread_setprio
(
pthread_t
thread_id
,
int
prior
)
{
{
...
@@ -320,7 +323,9 @@ void *sigwait_thread(void *set_arg)
...
@@ -320,7 +323,9 @@ void *sigwait_thread(void *set_arg)
sigaction
(
i
,
&
sact
,
(
struct
sigaction
*
)
0
);
sigaction
(
i
,
&
sact
,
(
struct
sigaction
*
)
0
);
}
}
}
}
sigaddset
(
set
,
THR_CLIENT_ALARM
);
/* Ensure that init_thr_alarm() is called */
DBUG_ASSERT
(
thr_client_alarm
);
sigaddset
(
set
,
thr_client_alarm
);
pthread_sigmask
(
SIG_UNBLOCK
,(
sigset_t
*
)
set
,(
sigset_t
*
)
0
);
pthread_sigmask
(
SIG_UNBLOCK
,(
sigset_t
*
)
set
,(
sigset_t
*
)
0
);
alarm_thread
=
pthread_self
();
/* For thr_alarm */
alarm_thread
=
pthread_self
();
/* For thr_alarm */
...
...
mysys/my_thr_init.c
View file @
496d0d78
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "mysys_priv.h"
#include "mysys_priv.h"
#include <m_string.h>
#include <m_string.h>
#include <signal.h>
#ifdef THREAD
#ifdef THREAD
#ifdef USE_TLS
#ifdef USE_TLS
...
@@ -44,6 +45,8 @@ pthread_mutexattr_t my_fast_mutexattr;
...
@@ -44,6 +45,8 @@ pthread_mutexattr_t my_fast_mutexattr;
pthread_mutexattr_t
my_errchk_mutexattr
;
pthread_mutexattr_t
my_errchk_mutexattr
;
#endif
#endif
static
uint
get_thread_lib
(
void
);
/*
/*
initialize thread environment
initialize thread environment
...
@@ -57,6 +60,12 @@ pthread_mutexattr_t my_errchk_mutexattr;
...
@@ -57,6 +60,12 @@ pthread_mutexattr_t my_errchk_mutexattr;
my_bool
my_thread_global_init
(
void
)
my_bool
my_thread_global_init
(
void
)
{
{
thd_lib_detected
=
get_thread_lib
();
if
(
thd_lib_detected
==
THD_LIB_LT
)
thr_client_alarm
=
SIGALRM
;
else
thr_client_alarm
=
SIGUSR1
;
if
(
pthread_key_create
(
&
THR_KEY_mysys
,
0
))
if
(
pthread_key_create
(
&
THR_KEY_mysys
,
0
))
{
{
fprintf
(
stderr
,
"Can't initialize threads: error %d
\n
"
,
errno
);
fprintf
(
stderr
,
"Can't initialize threads: error %d
\n
"
,
errno
);
...
@@ -276,4 +285,20 @@ const char *my_thread_name(void)
...
@@ -276,4 +285,20 @@ const char *my_thread_name(void)
}
}
#endif
/* DBUG_OFF */
#endif
/* DBUG_OFF */
static
uint
get_thread_lib
(
void
)
{
char
buff
[
64
];
#ifdef _CS_GNU_LIBPTHREAD_VERSION
confstr
(
_CS_GNU_LIBPTHREAD_VERSION
,
buff
,
sizeof
(
buff
));
if
(
!
strncasecmp
(
buff
,
"NPTL"
,
4
))
return
THD_LIB_NPTL
;
if
(
!
strncasecmp
(
buff
,
"linuxthreads"
,
12
))
return
THD_LIB_LT
;
#endif
return
THD_LIB_OTHER
;
}
#endif
/* THREAD */
#endif
/* THREAD */
mysys/thr_alarm.c
View file @
496d0d78
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#define ETIME ETIMEDOUT
#define ETIME ETIMEDOUT
#endif
#endif
uint
thr_client_alarm
;
static
int
alarm_aborted
=
1
;
/* No alarm thread */
static
int
alarm_aborted
=
1
;
/* No alarm thread */
my_bool
thr_alarm_inited
=
0
;
my_bool
thr_alarm_inited
=
0
;
volatile
my_bool
alarm_thread_running
=
0
;
volatile
my_bool
alarm_thread_running
=
0
;
...
@@ -59,9 +60,7 @@ static void *alarm_handler(void *arg);
...
@@ -59,9 +60,7 @@ static void *alarm_handler(void *arg);
#define reschedule_alarms() pthread_kill(alarm_thread,THR_SERVER_ALARM)
#define reschedule_alarms() pthread_kill(alarm_thread,THR_SERVER_ALARM)
#endif
#endif
#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
static
sig_handler
thread_alarm
(
int
sig
__attribute__
((
unused
)));
static
sig_handler
thread_alarm
(
int
sig
__attribute__
((
unused
)));
#endif
static
int
compare_ulong
(
void
*
not_used
__attribute__
((
unused
)),
static
int
compare_ulong
(
void
*
not_used
__attribute__
((
unused
)),
byte
*
a_ptr
,
byte
*
b_ptr
)
byte
*
a_ptr
,
byte
*
b_ptr
)
...
@@ -77,21 +76,19 @@ void init_thr_alarm(uint max_alarms)
...
@@ -77,21 +76,19 @@ void init_thr_alarm(uint max_alarms)
alarm_aborted
=
0
;
alarm_aborted
=
0
;
init_queue
(
&
alarm_queue
,
max_alarms
+
1
,
offsetof
(
ALARM
,
expire_time
),
0
,
init_queue
(
&
alarm_queue
,
max_alarms
+
1
,
offsetof
(
ALARM
,
expire_time
),
0
,
compare_ulong
,
NullS
);
compare_ulong
,
NullS
);
sigfillset
(
&
full_signal_set
);
/* Ne
a
ded to block signals */
sigfillset
(
&
full_signal_set
);
/* Ne
e
ded to block signals */
pthread_mutex_init
(
&
LOCK_alarm
,
MY_MUTEX_INIT_FAST
);
pthread_mutex_init
(
&
LOCK_alarm
,
MY_MUTEX_INIT_FAST
);
pthread_cond_init
(
&
COND_alarm
,
NULL
);
pthread_cond_init
(
&
COND_alarm
,
NULL
);
#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
if
(
thd_lib_detected
==
THD_LIB_LT
)
#if defined(HAVE_mit_thread)
thr_client_alarm
=
SIGALRM
;
sigset
(
THR_CLIENT_ALARM
,
thread_alarm
);
/* int. thread system calls */
else
#else
thr_client_alarm
=
SIGUSR1
;
#ifndef USE_ALARM_THREAD
if
(
thd_lib_detected
!=
THD_LIB_LT
)
#endif
{
{
struct
sigaction
sact
;
my_sigset
(
thr_client_alarm
,
thread_alarm
);
sact
.
sa_flags
=
0
;
sact
.
sa_handler
=
thread_alarm
;
sigaction
(
THR_CLIENT_ALARM
,
&
sact
,
(
struct
sigaction
*
)
0
);
}
}
#endif
#endif
sigemptyset
(
&
s
);
sigemptyset
(
&
s
);
sigaddset
(
&
s
,
THR_SERVER_ALARM
);
sigaddset
(
&
s
,
THR_SERVER_ALARM
);
alarm_thread
=
pthread_self
();
alarm_thread
=
pthread_self
();
...
@@ -109,13 +106,14 @@ void init_thr_alarm(uint max_alarms)
...
@@ -109,13 +106,14 @@ void init_thr_alarm(uint max_alarms)
}
}
#elif defined(USE_ONE_SIGNAL_HAND)
#elif defined(USE_ONE_SIGNAL_HAND)
pthread_sigmask
(
SIG_BLOCK
,
&
s
,
NULL
);
/* used with sigwait() */
pthread_sigmask
(
SIG_BLOCK
,
&
s
,
NULL
);
/* used with sigwait() */
#if THR_SERVER_ALARM == THR_CLIENT_ALARM
if
(
thd_lib_detected
==
THD_LIB_LT
)
sigset
(
THR_CLIENT_ALARM
,
process_alarm
);
/* Linuxthreads */
{
pthread_sigmask
(
SIG_UNBLOCK
,
&
s
,
NULL
);
my_sigset
(
thr_client_alarm
,
process_alarm
);
/* Linuxthreads */
#endif
pthread_sigmask
(
SIG_UNBLOCK
,
&
s
,
NULL
);
}
#else
#else
my_sigset
(
THR_SERVER_ALARM
,
process_alarm
);
pthread_sigmask
(
SIG_UNBLOCK
,
&
s
,
NULL
);
pthread_sigmask
(
SIG_UNBLOCK
,
&
s
,
NULL
);
sigset
(
THR_SERVER_ALARM
,
process_alarm
);
#endif
#endif
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -163,7 +161,7 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
...
@@ -163,7 +161,7 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
now
=
(
ulong
)
time
((
time_t
*
)
0
);
now
=
(
ulong
)
time
((
time_t
*
)
0
);
pthread_sigmask
(
SIG_BLOCK
,
&
full_signal_set
,
&
old_mask
);
pthread_sigmask
(
SIG_BLOCK
,
&
full_signal_set
,
&
old_mask
);
pthread_mutex_lock
(
&
LOCK_alarm
);
/* Lock from threads & alarms */
pthread_mutex_lock
(
&
LOCK_alarm
);
/* Lock from threads & alarms */
if
(
alarm_aborted
>
0
)
if
(
alarm_aborted
>
0
)
{
/* No signal thread */
{
/* No signal thread */
DBUG_PRINT
(
"info"
,
(
"alarm aborted"
));
DBUG_PRINT
(
"info"
,
(
"alarm aborted"
));
...
@@ -249,7 +247,7 @@ void thr_end_alarm(thr_alarm_t *alarmed)
...
@@ -249,7 +247,7 @@ void thr_end_alarm(thr_alarm_t *alarmed)
if
(
alarm_data
->
malloced
)
if
(
alarm_data
->
malloced
)
my_free
((
gptr
)
alarm_data
,
MYF
(
0
));
my_free
((
gptr
)
alarm_data
,
MYF
(
0
));
found
++
;
found
++
;
#if
n
def DBUG_OFF
#ifdef DBUG_OFF
break
;
break
;
#endif
#endif
}
}
...
@@ -258,10 +256,11 @@ void thr_end_alarm(thr_alarm_t *alarmed)
...
@@ -258,10 +256,11 @@ void thr_end_alarm(thr_alarm_t *alarmed)
if
(
!
found
)
if
(
!
found
)
{
{
if
(
*
alarmed
)
if
(
*
alarmed
)
fprintf
(
stderr
,
"Warning: Didn't find alarm %lx in queue of %d alarms
\n
"
,
fprintf
(
stderr
,
(
long
)
*
alarmed
,
alarm_queue
.
elements
);
"Warning: Didn't find alarm 0x%lx in queue of %d alarms
\n
"
,
DBUG_PRINT
(
"warning"
,(
"Didn't find alarm %lx in queue
\n
"
,
(
long
)
*
alarmed
,
alarm_queue
.
elements
);
(
long
)
*
alarmed
));
DBUG_PRINT
(
"warning"
,(
"Didn't find alarm 0x%lx in queue
\n
"
,
(
long
)
*
alarmed
));
}
}
pthread_mutex_unlock
(
&
LOCK_alarm
);
pthread_mutex_unlock
(
&
LOCK_alarm
);
pthread_sigmask
(
SIG_SETMASK
,
&
old_mask
,
NULL
);
pthread_sigmask
(
SIG_SETMASK
,
&
old_mask
,
NULL
);
...
@@ -283,18 +282,17 @@ sig_handler process_alarm(int sig __attribute__((unused)))
...
@@ -283,18 +282,17 @@ sig_handler process_alarm(int sig __attribute__((unused)))
This must be first as we can't call DBUG inside an alarm for a normal thread
This must be first as we can't call DBUG inside an alarm for a normal thread
*/
*/
#if THR_SERVER_ALARM == THR_CLIENT_ALARM
if
(
thd_lib_detected
==
THD_LIB_LT
&&
if
(
!
pthread_equal
(
pthread_self
(),
alarm_thread
))
!
pthread_equal
(
pthread_self
(),
alarm_thread
))
{
{
#if defined(MAIN) && !defined(__bsdi__)
#if defined(MAIN) && !defined(__bsdi__)
printf
(
"thread_alarm
\n
"
);
fflush
(
stdout
);
printf
(
"thread_alarm
in process_alarm
\n
"
);
fflush
(
stdout
);
#endif
#endif
#ifdef DONT_REMEMBER_SIGNAL
#ifdef DONT_REMEMBER_SIGNAL
sigset
(
THR_CLIENT_ALARM
,
process_alarm
);
/* int. thread system calls */
my_sigset
(
thr_client_alarm
,
process_alarm
);
/* int. thread system calls */
#endif
#endif
return
;
return
;
}
}
#endif
/*
/*
We have to do do the handling of the alarm in a sub function,
We have to do do the handling of the alarm in a sub function,
...
@@ -310,7 +308,7 @@ sig_handler process_alarm(int sig __attribute__((unused)))
...
@@ -310,7 +308,7 @@ sig_handler process_alarm(int sig __attribute__((unused)))
process_alarm_part2
(
sig
);
process_alarm_part2
(
sig
);
#ifndef USE_ALARM_THREAD
#ifndef USE_ALARM_THREAD
#if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND)
#if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND)
sigset
(
THR_SERVER_ALARM
,
process_alarm
);
my_sigset
(
THR_SERVER_ALARM
,
process_alarm
);
#endif
#endif
pthread_mutex_unlock
(
&
LOCK_alarm
);
pthread_mutex_unlock
(
&
LOCK_alarm
);
pthread_sigmask
(
SIG_SETMASK
,
&
old_mask
,
NULL
);
pthread_sigmask
(
SIG_SETMASK
,
&
old_mask
,
NULL
);
...
@@ -338,7 +336,7 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused)))
...
@@ -338,7 +336,7 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused)))
alarm_data
=
(
ALARM
*
)
queue_element
(
&
alarm_queue
,
i
);
alarm_data
=
(
ALARM
*
)
queue_element
(
&
alarm_queue
,
i
);
alarm_data
->
alarmed
=
1
;
/* Info to thread */
alarm_data
->
alarmed
=
1
;
/* Info to thread */
if
(
pthread_equal
(
alarm_data
->
thread
,
alarm_thread
)
||
if
(
pthread_equal
(
alarm_data
->
thread
,
alarm_thread
)
||
pthread_kill
(
alarm_data
->
thread
,
THR_CLIENT_ALARM
))
pthread_kill
(
alarm_data
->
thread
,
thr_client_alarm
))
{
{
#ifdef MAIN
#ifdef MAIN
printf
(
"Warning: pthread_kill couldn't find thread!!!
\n
"
);
printf
(
"Warning: pthread_kill couldn't find thread!!!
\n
"
);
...
@@ -362,7 +360,7 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused)))
...
@@ -362,7 +360,7 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused)))
alarm_data
->
alarmed
=
1
;
/* Info to thread */
alarm_data
->
alarmed
=
1
;
/* Info to thread */
DBUG_PRINT
(
"info"
,(
"sending signal to waiting thread"
));
DBUG_PRINT
(
"info"
,(
"sending signal to waiting thread"
));
if
(
pthread_equal
(
alarm_data
->
thread
,
alarm_thread
)
||
if
(
pthread_equal
(
alarm_data
->
thread
,
alarm_thread
)
||
pthread_kill
(
alarm_data
->
thread
,
THR_CLIENT_ALARM
))
pthread_kill
(
alarm_data
->
thread
,
thr_client_alarm
))
{
{
#ifdef MAIN
#ifdef MAIN
printf
(
"Warning: pthread_kill couldn't find thread!!!
\n
"
);
printf
(
"Warning: pthread_kill couldn't find thread!!!
\n
"
);
...
@@ -439,16 +437,13 @@ void end_thr_alarm(my_bool free_structures)
...
@@ -439,16 +437,13 @@ void end_thr_alarm(my_bool free_structures)
if
(
error
==
ETIME
||
error
==
ETIMEDOUT
)
if
(
error
==
ETIME
||
error
==
ETIMEDOUT
)
break
;
/* Don't wait forever */
break
;
/* Don't wait forever */
}
}
if
(
!
alarm_queue
.
elements
)
delete_queue
(
&
alarm_queue
);
alarm_aborted
=
1
;
pthread_mutex_unlock
(
&
LOCK_alarm
);
if
(
!
alarm_thread_running
)
/* Safety */
{
{
delete_queue
(
&
alarm_queue
);
pthread_mutex_destroy
(
&
LOCK_alarm
);
alarm_aborted
=
1
;
pthread_cond_destroy
(
&
COND_alarm
);
pthread_mutex_unlock
(
&
LOCK_alarm
);
if
(
!
alarm_thread_running
)
/* Safety */
{
pthread_mutex_destroy
(
&
LOCK_alarm
);
pthread_cond_destroy
(
&
COND_alarm
);
}
}
}
}
}
else
else
...
@@ -505,17 +500,15 @@ void thr_alarm_info(ALARM_INFO *info)
...
@@ -505,17 +500,15 @@ void thr_alarm_info(ALARM_INFO *info)
ARGSUSED
ARGSUSED
*/
*/
#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
static
sig_handler
thread_alarm
(
int
sig
)
static
sig_handler
thread_alarm
(
int
sig
)
{
{
#ifdef MAIN
#ifdef MAIN
printf
(
"thread_alarm
\n
"
);
fflush
(
stdout
);
printf
(
"thread_alarm
\n
"
);
fflush
(
stdout
);
#endif
#endif
#ifdef DONT_REMEMBER_SIGNAL
#ifdef DONT_REMEMBER_SIGNAL
sigset
(
sig
,
thread_alarm
);
/* int. thread system calls */
my_sigset
(
sig
,
thread_alarm
);
/* int. thread system calls */
#endif
#endif
}
}
#endif
#ifdef HAVE_TIMESPEC_TS_SEC
#ifdef HAVE_TIMESPEC_TS_SEC
...
@@ -916,7 +909,7 @@ static sig_handler print_signal_warning(int sig)
...
@@ -916,7 +909,7 @@ static sig_handler print_signal_warning(int sig)
printf
(
"Warning: Got signal %d from thread %s
\n
"
,
sig
,
my_thread_name
());
printf
(
"Warning: Got signal %d from thread %s
\n
"
,
sig
,
my_thread_name
());
fflush
(
stdout
);
fflush
(
stdout
);
#ifdef DONT_REMEMBER_SIGNAL
#ifdef DONT_REMEMBER_SIGNAL
sigset
(
sig
,
print_signal_warning
);
/* int. thread system calls */
my_sigset
(
sig
,
print_signal_warning
);
/* int. thread system calls */
#endif
#endif
#ifndef OS2
#ifndef OS2
if
(
sig
==
SIGALRM
)
if
(
sig
==
SIGALRM
)
...
@@ -943,9 +936,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
...
@@ -943,9 +936,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
sigaddset
(
&
set
,
SIGINT
);
sigaddset
(
&
set
,
SIGINT
);
sigaddset
(
&
set
,
SIGQUIT
);
sigaddset
(
&
set
,
SIGQUIT
);
sigaddset
(
&
set
,
SIGTERM
);
sigaddset
(
&
set
,
SIGTERM
);
#if THR_CLIENT_ALARM != SIGHUP
sigaddset
(
&
set
,
SIGHUP
);
sigaddset
(
&
set
,
SIGHUP
);
#endif
#ifdef SIGTSTP
#ifdef SIGTSTP
sigaddset
(
&
set
,
SIGTSTP
);
sigaddset
(
&
set
,
SIGTSTP
);
#endif
#endif
...
@@ -957,7 +948,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
...
@@ -957,7 +948,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
#endif
#endif
#endif
/* OS2 */
#endif
/* OS2 */
printf
(
"server alarm: %d thread alarm: %d
\n
"
,
printf
(
"server alarm: %d thread alarm: %d
\n
"
,
THR_SERVER_ALARM
,
THR_CLIENT_ALARM
);
THR_SERVER_ALARM
,
thr_client_alarm
);
DBUG_PRINT
(
"info"
,(
"Starting signal and alarm handling thread"
));
DBUG_PRINT
(
"info"
,(
"Starting signal and alarm handling thread"
));
for
(;;)
for
(;;)
{
{
...
@@ -1029,11 +1020,11 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
...
@@ -1029,11 +1020,11 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
sigaddset
(
&
set
,
SIGTSTP
);
sigaddset
(
&
set
,
SIGTSTP
);
#endif
#endif
sigaddset
(
&
set
,
THR_SERVER_ALARM
);
sigaddset
(
&
set
,
THR_SERVER_ALARM
);
sigdelset
(
&
set
,
THR_CLIENT_ALARM
);
sigdelset
(
&
set
,
thr_client_alarm
);
(
void
)
pthread_sigmask
(
SIG_SETMASK
,
&
set
,
NULL
);
(
void
)
pthread_sigmask
(
SIG_SETMASK
,
&
set
,
NULL
);
#ifdef NOT_USED
#ifdef NOT_USED
sigemptyset
(
&
set
);
sigemptyset
(
&
set
);
sigaddset
(
&
set
,
THR_CLIENT_ALARM
);
sigaddset
(
&
set
,
thr_client_alarm
);
VOID
(
pthread_sigmask
(
SIG_UNBLOCK
,
&
set
,
(
sigset_t
*
)
0
));
VOID
(
pthread_sigmask
(
SIG_UNBLOCK
,
&
set
,
(
sigset_t
*
)
0
));
#endif
#endif
#endif
/* OS2 */
#endif
/* OS2 */
...
@@ -1083,8 +1074,8 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
...
@@ -1083,8 +1074,8 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
}
}
}
}
pthread_mutex_unlock
(
&
LOCK_thread_count
);
pthread_mutex_unlock
(
&
LOCK_thread_count
);
end_thr_alarm
(
1
);
thr_alarm_info
(
&
alarm_info
);
thr_alarm_info
(
&
alarm_info
);
end_thr_alarm
(
1
);
printf
(
"Main_thread: Alarms: %u max_alarms: %u next_alarm_time: %lu
\n
"
,
printf
(
"Main_thread: Alarms: %u max_alarms: %u next_alarm_time: %lu
\n
"
,
alarm_info
.
active_alarms
,
alarm_info
.
max_used_alarms
,
alarm_info
.
active_alarms
,
alarm_info
.
max_used_alarms
,
alarm_info
.
next_alarm_time
);
alarm_info
.
next_alarm_time
);
...
...
sql/mysqld.cc
View file @
496d0d78
...
@@ -177,12 +177,6 @@ inline void reset_floating_point_exceptions()
...
@@ -177,12 +177,6 @@ inline void reset_floating_point_exceptions()
}
/* cplusplus */
}
/* cplusplus */
#if defined(HAVE_LINUXTHREADS)
#define THR_KILL_SIGNAL SIGINT
#else
#define THR_KILL_SIGNAL SIGUSR2 // Can't use this with LinuxThreads
#endif
#ifdef HAVE_GLIBC2_STYLE_GETHOSTBYNAME_R
#ifdef HAVE_GLIBC2_STYLE_GETHOSTBYNAME_R
#include <sys/types.h>
#include <sys/types.h>
#else
#else
...
@@ -465,6 +459,7 @@ pthread_cond_t COND_refresh,COND_thread_count, COND_slave_stopped,
...
@@ -465,6 +459,7 @@ pthread_cond_t COND_refresh,COND_thread_count, COND_slave_stopped,
pthread_cond_t
COND_thread_cache
,
COND_flush_thread_cache
;
pthread_cond_t
COND_thread_cache
,
COND_flush_thread_cache
;
pthread_t
signal_thread
;
pthread_t
signal_thread
;
pthread_attr_t
connection_attrib
;
pthread_attr_t
connection_attrib
;
static
uint
thr_kill_signal
;
#ifdef __WIN__
#ifdef __WIN__
#undef getpid
#undef getpid
...
@@ -544,7 +539,7 @@ static void close_connections(void)
...
@@ -544,7 +539,7 @@ static void close_connections(void)
DBUG_PRINT
(
"info"
,(
"Waiting for select_thread"
));
DBUG_PRINT
(
"info"
,(
"Waiting for select_thread"
));
#ifndef DONT_USE_THR_ALARM
#ifndef DONT_USE_THR_ALARM
if
(
pthread_kill
(
select_thread
,
THR_CLIENT_ALARM
))
if
(
pthread_kill
(
select_thread
,
thr_client_alarm
))
break
;
// allready dead
break
;
// allready dead
#endif
#endif
set_timespec
(
abstime
,
2
);
set_timespec
(
abstime
,
2
);
...
@@ -844,7 +839,7 @@ extern "C" sig_handler print_signal_warning(int sig)
...
@@ -844,7 +839,7 @@ extern "C" sig_handler print_signal_warning(int sig)
sig
,
my_thread_id
());
sig
,
my_thread_id
());
}
}
#ifdef DONT_REMEMBER_SIGNAL
#ifdef DONT_REMEMBER_SIGNAL
sigset
(
sig
,
print_signal_warning
);
/* int. thread system calls */
my_sigset
(
sig
,
print_signal_warning
);
/* int. thread system calls */
#endif
#endif
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
if
(
sig
==
SIGALRM
)
if
(
sig
==
SIGALRM
)
...
@@ -1841,8 +1836,10 @@ static void init_signals(void)
...
@@ -1841,8 +1836,10 @@ static void init_signals(void)
DBUG_ENTER
(
"init_signals"
);
DBUG_ENTER
(
"init_signals"
);
if
(
test_flags
&
TEST_SIGINT
)
if
(
test_flags
&
TEST_SIGINT
)
sigset
(
THR_KILL_SIGNAL
,
end_thread_signal
);
{
sigset
(
THR_SERVER_ALARM
,
print_signal_warning
);
// Should never be called!
my_sigset
(
thr_kill_signal
,
end_thread_signal
);
}
my_sigset
(
THR_SERVER_ALARM
,
print_signal_warning
);
// Should never be called!
if
(
!
(
test_flags
&
TEST_NO_STACKTRACE
)
||
(
test_flags
&
TEST_CORE_ON_SIGNAL
))
if
(
!
(
test_flags
&
TEST_NO_STACKTRACE
)
||
(
test_flags
&
TEST_CORE_ON_SIGNAL
))
{
{
...
@@ -1877,7 +1874,7 @@ static void init_signals(void)
...
@@ -1877,7 +1874,7 @@ static void init_signals(void)
#endif
#endif
(
void
)
sigemptyset
(
&
set
);
(
void
)
sigemptyset
(
&
set
);
#ifdef THREAD_SPECIFIC_SIGPIPE
#ifdef THREAD_SPECIFIC_SIGPIPE
sigset
(
SIGPIPE
,
abort_thread
);
my_sigset
(
SIGPIPE
,
abort_thread
);
sigaddset
(
&
set
,
SIGPIPE
);
sigaddset
(
&
set
,
SIGPIPE
);
#else
#else
(
void
)
signal
(
SIGPIPE
,
SIG_IGN
);
// Can't know which thread
(
void
)
signal
(
SIGPIPE
,
SIG_IGN
);
// Can't know which thread
...
@@ -1903,8 +1900,12 @@ static void init_signals(void)
...
@@ -1903,8 +1900,12 @@ static void init_signals(void)
#endif
#endif
sigaddset
(
&
set
,
THR_SERVER_ALARM
);
sigaddset
(
&
set
,
THR_SERVER_ALARM
);
if
(
test_flags
&
TEST_SIGINT
)
if
(
test_flags
&
TEST_SIGINT
)
sigdelset
(
&
set
,
THR_KILL_SIGNAL
);
// May be SIGINT
{
sigdelset
(
&
set
,
THR_CLIENT_ALARM
);
// For alarms
// May be SIGINT
sigdelset
(
&
set
,
thr_kill_signal
);
}
// For alarms
sigdelset
(
&
set
,
thr_client_alarm
);
sigprocmask
(
SIG_SETMASK
,
&
set
,
NULL
);
sigprocmask
(
SIG_SETMASK
,
&
set
,
NULL
);
pthread_sigmask
(
SIG_SETMASK
,
&
set
,
NULL
);
pthread_sigmask
(
SIG_SETMASK
,
&
set
,
NULL
);
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
...
@@ -1959,23 +1960,19 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
...
@@ -1959,23 +1960,19 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
*/
*/
init_thr_alarm
(
max_connections
+
init_thr_alarm
(
max_connections
+
global_system_variables
.
max_insert_delayed_threads
+
10
);
global_system_variables
.
max_insert_delayed_threads
+
10
);
#if SIGINT != THR_KILL_SIGNAL
if
(
thd_lib_detected
!=
THD_LIB_LT
&&
(
test_flags
&
TEST_SIGINT
))
if
(
test_flags
&
TEST_SIGINT
)
{
{
(
void
)
sigemptyset
(
&
set
);
// Setup up SIGINT for debug
(
void
)
sigemptyset
(
&
set
);
// Setup up SIGINT for debug
(
void
)
sigaddset
(
&
set
,
SIGINT
);
// For debugging
(
void
)
sigaddset
(
&
set
,
SIGINT
);
// For debugging
(
void
)
pthread_sigmask
(
SIG_UNBLOCK
,
&
set
,
NULL
);
(
void
)
pthread_sigmask
(
SIG_UNBLOCK
,
&
set
,
NULL
);
}
}
#endif
(
void
)
sigemptyset
(
&
set
);
// Setup up SIGINT for debug
(
void
)
sigemptyset
(
&
set
);
// Setup up SIGINT for debug
#ifdef USE_ONE_SIGNAL_HAND
#ifdef USE_ONE_SIGNAL_HAND
(
void
)
sigaddset
(
&
set
,
THR_SERVER_ALARM
);
// For alarms
(
void
)
sigaddset
(
&
set
,
THR_SERVER_ALARM
);
// For alarms
#endif
#endif
#ifndef IGNORE_SIGHUP_SIGQUIT
#ifndef IGNORE_SIGHUP_SIGQUIT
(
void
)
sigaddset
(
&
set
,
SIGQUIT
);
(
void
)
sigaddset
(
&
set
,
SIGQUIT
);
#if THR_CLIENT_ALARM != SIGHUP
(
void
)
sigaddset
(
&
set
,
SIGHUP
);
(
void
)
sigaddset
(
&
set
,
SIGHUP
);
#endif
#endif
#endif
(
void
)
sigaddset
(
&
set
,
SIGTERM
);
(
void
)
sigaddset
(
&
set
,
SIGTERM
);
(
void
)
sigaddset
(
&
set
,
SIGTSTP
);
(
void
)
sigaddset
(
&
set
,
SIGTSTP
);
...
@@ -2237,7 +2234,6 @@ int main(int argc, char **argv)
...
@@ -2237,7 +2234,6 @@ int main(int argc, char **argv)
tzset
();
// Set tzname
tzset
();
// Set tzname
start_time
=
time
((
time_t
*
)
0
);
start_time
=
time
((
time_t
*
)
0
);
#ifdef OS2
#ifdef OS2
{
{
// fix timezone for daylight saving
// fix timezone for daylight saving
...
@@ -2254,6 +2250,9 @@ int main(int argc, char **argv)
...
@@ -2254,6 +2250,9 @@ int main(int argc, char **argv)
}
}
#endif
#endif
/* Set signal used to kill MySQL */
thr_kill_signal
=
thd_lib_detected
==
THD_LIB_LT
?
SIGINT
:
SIGUSR2
;
/*
/*
Init mutexes for the global MYSQL_LOG objects.
Init mutexes for the global MYSQL_LOG objects.
As safe_mutex depends on what MY_INIT() does, we can't init the mutexes of
As safe_mutex depends on what MY_INIT() does, we can't init the mutexes of
...
...
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