diff options
author | unknown <monty@hundin.mysql.fi> | 2002-08-21 23:31:33 +0300 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-08-21 23:31:33 +0300 |
commit | 656da11b9163261ab661f1c22c16758e7b5482a6 (patch) | |
tree | 9ded9399004e592a31fb8cd0f72e01e53ccf3301 /mysys/thr_alarm.c | |
parent | 7ba2adcc0184aaa72ec284de6930f0ae0c72852c (diff) | |
download | mariadb-git-656da11b9163261ab661f1c22c16758e7b5482a6.tar.gz |
Portability fix.
mysys/thr_alarm.c:
Fixed portability problem with thr_alarm.c
readline/display.c:
Removed compiler warning
sql/net_serv.cc:
Added DBUG_ENTER in net_clear.
Diffstat (limited to 'mysys/thr_alarm.c')
-rw-r--r-- | mysys/thr_alarm.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 902b8212cca..11e6fa97ab6 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -39,6 +39,8 @@ static my_bool alarm_aborted=1; my_bool thr_alarm_inited=0; +static sig_handler process_alarm_part2(int sig); + #if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) static pthread_mutex_t LOCK_alarm; @@ -244,8 +246,6 @@ void thr_end_alarm(thr_alarm_t *alarmed) sig_handler process_alarm(int sig __attribute__((unused))) { sigset_t old_mask; - ALARM *alarm_data; - /* This must be first as we can't call DBUG inside an alarm for a normal thread */ @@ -262,11 +262,33 @@ sig_handler process_alarm(int sig __attribute__((unused))) return; } #endif - { + + /* + We have to do do the handling of the alarm in a sub function, + because otherwise we would get problems with two threads calling + DBUG_... functions at the same time (as two threads may call + process_alarm() at the same time + */ + #ifndef USE_ALARM_THREAD pthread_sigmask(SIG_SETMASK,&full_signal_set,&old_mask); pthread_mutex_lock(&LOCK_alarm); #endif + process_alarm_part2(sig); +#ifndef USE_ALARM_THREAD +#if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND) + sigset(THR_SERVER_ALARM,process_alarm); +#endif + pthread_mutex_unlock(&LOCK_alarm); + pthread_sigmask(SIG_SETMASK,&old_mask,NULL); +#endif + return; +} + + +static sig_handler process_alarm_part2(int sig __attribute__((unused))) +{ + ALARM *alarm_data; DBUG_ENTER("process_alarm"); DBUG_PRINT("info",("sig: %d active alarms: %d",sig,alarm_queue.elements)); @@ -333,15 +355,7 @@ sig_handler process_alarm(int sig __attribute__((unused))) #endif } } -#ifndef USE_ALARM_THREAD -#if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND) - sigset(THR_SERVER_ALARM,process_alarm); -#endif - pthread_mutex_unlock(&LOCK_alarm); - pthread_sigmask(SIG_SETMASK,&old_mask,NULL); -#endif DBUG_VOID_RETURN; - } } |