summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorjimw@mysql.com <>2005-10-11 09:12:12 -0700
committerjimw@mysql.com <>2005-10-11 09:12:12 -0700
commitc8a6c2c6143dd8c92704920d455cc57050ce71ad (patch)
tree4607d81d45be27a727b93a40191ed4853e10f8ef /mysys
parent52181cc810ecf3d2103d7782055c14b7157aabcb (diff)
downloadmariadb-git-c8a6c2c6143dd8c92704920d455cc57050ce71ad.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)
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_pthread.c17
-rw-r--r--mysys/thr_alarm.c24
2 files changed, 7 insertions, 34 deletions
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index 37517fb8327..315e966bf43 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -404,23 +404,6 @@ int sigwait(sigset_t *setp, int *sigp)
#endif /* DONT_USE_SIGSUSPEND */
#endif /* HAVE_SIGWAIT */
-/*****************************************************************************
-** Implement pthread_signal for systems that can't use signal() with threads
-** Currently this is only used with BSDI 3.0
-*****************************************************************************/
-
-#ifdef USE_PTHREAD_SIGNAL
-
-int pthread_signal(int sig, void (*func)())
-{
- struct sigaction sact;
- sact.sa_flags= 0;
- sact.sa_handler= func;
- sigemptyset(&sact.sa_mask);
- sigaction(sig, &sact, (struct sigaction*) 0);
- return 0;
-}
-#endif
/****************************************************************************
The following functions fixes that all pthread functions should work
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c
index 05d14073953..e5b77de5e38 100644
--- a/mysys/thr_alarm.c
+++ b/mysys/thr_alarm.c
@@ -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)