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