1
/* Copyright (C) 2000 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
17
File to include when we want to use alarm or a loop_counter to display
18
some information when a program is running
26
extern int volatile my_have_got_alarm;
27
extern ulong my_time_to_wait_for_lock;
29
#if defined(HAVE_ALARM) && !defined(NO_ALARM_LOOP)
31
#define ALARM_VARIABLES uint alarm_old=0; \
32
sig_return alarm_signal=0
33
#define ALARM_INIT my_have_got_alarm=0 ; \
34
alarm_old=(uint) alarm(MY_HOW_OFTEN_TO_ALARM); \
35
alarm_signal=signal(SIGALRM,my_set_alarm_variable);
36
#define ALARM_END VOID(signal(SIGALRM,alarm_signal)); \
37
VOID(alarm(alarm_old));
38
#define ALARM_TEST my_have_got_alarm
39
#ifdef DONT_REMEMBER_SIGNAL
40
#define ALARM_REINIT VOID(alarm(MY_HOW_OFTEN_TO_ALARM)); \
41
VOID(signal(SIGALRM,my_set_alarm_variable));\
44
#define ALARM_REINIT VOID(alarm((uint) MY_HOW_OFTEN_TO_ALARM)); \
46
#endif /* DONT_REMEMBER_SIGNAL */
48
#define ALARM_VARIABLES long alarm_pos=0,alarm_end_pos=MY_HOW_OFTEN_TO_WRITE-1
51
#define ALARM_TEST (alarm_pos++ >= alarm_end_pos)
52
#define ALARM_REINIT alarm_end_pos+=MY_HOW_OFTEN_TO_WRITE
53
#endif /* HAVE_ALARM */