diff options
author | unknown <jimw@mysql.com> | 2005-10-11 09:12:12 -0700 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-10-11 09:12:12 -0700 |
commit | e61dea1b3676844cf78e3cece5d5db1d4a0e847d (patch) | |
tree | 4607d81d45be27a727b93a40191ed4853e10f8ef /sql/mysqld.cc | |
parent | 78f5997adef773dfd5b05f6921b5da8066067c37 (diff) | |
download | mariadb-git-e61dea1b3676844cf78e3cece5d5db1d4a0e847d.tar.gz |
Fix wait_timeout (and kill) handling on Mac OS X by cleaning up how
signal handlers are set up, the blocking flags for sockets are set,
and which thread-related functions are used. (Bug #8731)
configure.in:
Fix flags for Darwin 6 and later. Simplify Darwin 7-9 blocks to simply
be a catch-all for *darwin* so that future Darwin releases get the
latest flags.
include/config-win.h:
Define my_sigset() instead of sigset().
include/my_pthread.h:
Define my_sigset() instead of trying to monkey with sigset(), and favor
an implementation based on sigaction().
mysys/my_pthread.c:
Remove pthread_signal(), which is identical to the new my_sigset() macro.
mysys/thr_alarm.c:
Use my_sigset() instead of sigset().
sql/mysqld.cc:
Use my_sigset() instead of signal() and sigset(), remove unnecessary
definition of sigset on __amiga__. Remove unused THREAD_SPECIFIC_SIGPIPE
code.
A future improvement would be to re-assess the use of sigaction() here
and convert its usage to use my_sigset().
vio/vio.c:
Always call fcntl() to initialize flags of socket in initialization to
avoid problems on systems that don't report the flags on a socket
correctly right after it has been returned from accept(), such as
FreeBSD, Mac OS X, and possibly other BSD-derived systems.
vio/viosocket.c:
If fcntl() fails in vio_blocking(), restore the flags stored in the
vio struct.
mysql-test/r/wait_timeout.result:
New BitKeeper file ``mysql-test/r/wait_timeout.result''
mysql-test/t/wait_timeout-master.opt:
New BitKeeper file ``mysql-test/t/wait_timeout-master.opt''
mysql-test/t/wait_timeout.test:
New BitKeeper file ``mysql-test/t/wait_timeout.test''
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r-- | sql/mysqld.cc | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a6a91ac32ee..feb63e10b9f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -846,7 +846,7 @@ static void __cdecl kill_server(int sig_ptr) RETURN_FROM_KILL_SERVER; kill_in_progress=TRUE; abort_loop=1; // This should be set - signal(sig,SIG_IGN); + my_sigset(sig,SIG_IGN); if (sig == MYSQL_KILL_SIGNAL || sig == 0) sql_print_information(ER(ER_NORMAL_SHUTDOWN),my_progname); else @@ -894,11 +894,6 @@ extern "C" pthread_handler_decl(kill_server_thread,arg __attribute__((unused))) } #endif -#if defined(__amiga__) -#undef sigset -#define sigset signal -#endif - extern "C" sig_handler print_signal_warning(int sig) { if (!DBUG_IN_USE) @@ -908,7 +903,7 @@ extern "C" sig_handler print_signal_warning(int sig) sig,my_thread_id()); } #ifdef DONT_REMEMBER_SIGNAL - sigset(sig,print_signal_warning); /* int. thread system calls */ + my_sigset(sig,print_signal_warning); /* int. thread system calls */ #endif #if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) if (sig == SIGALRM) @@ -1570,23 +1565,6 @@ void flush_thread_cache() } -/* - Aborts a thread nicely. Commes here on SIGPIPE - TODO: One should have to fix that thr_alarm know about this - thread too. -*/ - -#ifdef THREAD_SPECIFIC_SIGPIPE -extern "C" sig_handler abort_thread(int sig __attribute__((unused))) -{ - THD *thd=current_thd; - DBUG_ENTER("abort_thread"); - if (thd) - thd->killed=1; - DBUG_VOID_RETURN; -} -#endif - /****************************************************************************** Setup a signal thread with handles all signals. Because Linux doesn't support schemas use a mutex to check that @@ -2002,8 +1980,8 @@ static void init_signals(void) DBUG_ENTER("init_signals"); 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)) { @@ -2037,13 +2015,8 @@ static void init_signals(void) } #endif (void) sigemptyset(&set); -#ifdef THREAD_SPECIFIC_SIGPIPE - sigset(SIGPIPE,abort_thread); - sigaddset(&set,SIGPIPE); -#else - (void) signal(SIGPIPE,SIG_IGN); // Can't know which thread + my_sigset(SIGPIPE,SIG_IGN); sigaddset(&set,SIGPIPE); -#endif sigaddset(&set,SIGINT); #ifndef IGNORE_SIGHUP_SIGQUIT sigaddset(&set,SIGQUIT); |