Eneboo - Documentación para desarrolladores
src/libmysql_std/include/my_alarm.h
Ir a la documentación de este archivo.
00001 /* Copyright (C) 2000 MySQL AB
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; version 2 of the License.
00006 
00007    This program is distributed in the hope that it will be useful,
00008    but WITHOUT ANY WARRANTY; without even the implied warranty of
00009    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010    GNU General Public License for more details.
00011 
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software
00014    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
00015 
00016 /*
00017   File to include when we want to use alarm or a loop_counter to display
00018   some information when a program is running
00019 */
00020 #ifndef _my_alarm_h
00021 #define _my_alarm_h
00022 #ifdef  __cplusplus
00023 extern "C" {
00024 #endif
00025 
00026 extern int volatile my_have_got_alarm;
00027 extern ulong my_time_to_wait_for_lock;
00028 
00029 #if defined(HAVE_ALARM) && !defined(NO_ALARM_LOOP)
00030 #include <signal.h>
00031 #define ALARM_VARIABLES uint alarm_old=0; \
00032                         sig_return alarm_signal=0
00033 #define ALARM_INIT      my_have_got_alarm=0 ; \
00034                         alarm_old=(uint) alarm(MY_HOW_OFTEN_TO_ALARM); \
00035                         alarm_signal=signal(SIGALRM,my_set_alarm_variable);
00036 #define ALARM_END       VOID(signal(SIGALRM,alarm_signal)); \
00037                         VOID(alarm(alarm_old));
00038 #define ALARM_TEST      my_have_got_alarm
00039 #ifdef DONT_REMEMBER_SIGNAL
00040 #define ALARM_REINIT    VOID(alarm(MY_HOW_OFTEN_TO_ALARM)); \
00041                         VOID(signal(SIGALRM,my_set_alarm_variable));\
00042                         my_have_got_alarm=0;
00043 #else
00044 #define ALARM_REINIT    VOID(alarm((uint) MY_HOW_OFTEN_TO_ALARM)); \
00045                         my_have_got_alarm=0;
00046 #endif /* DONT_REMEMBER_SIGNAL */
00047 #else
00048 #define ALARM_VARIABLES long alarm_pos=0,alarm_end_pos=MY_HOW_OFTEN_TO_WRITE-1
00049 #define ALARM_INIT
00050 #define ALARM_END
00051 #define ALARM_TEST (alarm_pos++ >= alarm_end_pos)
00052 #define ALARM_REINIT alarm_end_pos+=MY_HOW_OFTEN_TO_WRITE
00053 #endif /* HAVE_ALARM */
00054 
00055 #ifdef  __cplusplus
00056 }
00057 #endif
00058 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'