mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
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)
This commit is contained in:
@@ -80,17 +80,7 @@ void init_thr_alarm(uint max_alarms)
|
||||
pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST);
|
||||
pthread_cond_init(&COND_alarm,NULL);
|
||||
#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
|
||||
#if defined(HAVE_mit_thread)
|
||||
sigset(THR_CLIENT_ALARM,thread_alarm); /* int. thread system calls */
|
||||
#else
|
||||
{
|
||||
struct sigaction sact;
|
||||
sact.sa_flags = 0;
|
||||
bzero((char*) &sact, sizeof(sact));
|
||||
sact.sa_handler = thread_alarm;
|
||||
sigaction(THR_CLIENT_ALARM, &sact, (struct sigaction*) 0);
|
||||
}
|
||||
#endif
|
||||
my_sigset(THR_CLIENT_ALARM,thread_alarm);
|
||||
#endif
|
||||
sigemptyset(&s);
|
||||
sigaddset(&s, THR_SERVER_ALARM);
|
||||
@@ -110,12 +100,12 @@ void init_thr_alarm(uint max_alarms)
|
||||
#elif defined(USE_ONE_SIGNAL_HAND)
|
||||
pthread_sigmask(SIG_BLOCK, &s, NULL); /* used with sigwait() */
|
||||
#if THR_SERVER_ALARM == THR_CLIENT_ALARM
|
||||
sigset(THR_CLIENT_ALARM,process_alarm); /* Linuxthreads */
|
||||
my_sigset(THR_CLIENT_ALARM,process_alarm); /* Linuxthreads */
|
||||
pthread_sigmask(SIG_UNBLOCK, &s, NULL);
|
||||
#endif
|
||||
#else
|
||||
my_sigset(THR_SERVER_ALARM, process_alarm);
|
||||
pthread_sigmask(SIG_UNBLOCK, &s, NULL);
|
||||
sigset(THR_SERVER_ALARM,process_alarm);
|
||||
#endif
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
@@ -290,7 +280,7 @@ sig_handler process_alarm(int sig __attribute__((unused)))
|
||||
printf("thread_alarm\n"); fflush(stdout);
|
||||
#endif
|
||||
#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
|
||||
return;
|
||||
}
|
||||
@@ -310,7 +300,7 @@ sig_handler process_alarm(int sig __attribute__((unused)))
|
||||
process_alarm_part2(sig);
|
||||
#ifndef USE_ALARM_THREAD
|
||||
#if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND)
|
||||
sigset(THR_SERVER_ALARM,process_alarm);
|
||||
my_sigset(THR_SERVER_ALARM,process_alarm);
|
||||
#endif
|
||||
pthread_mutex_unlock(&LOCK_alarm);
|
||||
pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
|
||||
@@ -512,7 +502,7 @@ static sig_handler thread_alarm(int sig)
|
||||
printf("thread_alarm\n"); fflush(stdout);
|
||||
#endif
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
sigset(sig,thread_alarm); /* int. thread system calls */
|
||||
my_sigset(sig,thread_alarm); /* int. thread system calls */
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -916,7 +906,7 @@ static sig_handler print_signal_warning(int sig)
|
||||
printf("Warning: Got signal %d from thread %s\n",sig,my_thread_name());
|
||||
fflush(stdout);
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
sigset(sig,print_signal_warning); /* int. thread system calls */
|
||||
my_sigset(sig,print_signal_warning); /* int. thread system calls */
|
||||
#endif
|
||||
#ifndef OS2
|
||||
if (sig == SIGALRM)
|
||||
|
||||
Reference in New Issue
Block a user