00001 /* 00002 * Copyright 2004, 2005 PathScale, Inc. All Rights Reserved. 00003 */ 00004 00005 /* 00006 00007 Copyright (C) 1999-2001, Silicon Graphics, Inc. All Rights Reserved. 00008 00009 This program is free software; you can redistribute it and/or modify it 00010 under the terms of version 2.1 of the GNU Lesser General Public License 00011 as published by the Free Software Foundation. 00012 00013 This program is distributed in the hope that it would be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, any 00016 license provided herein, whether implied or otherwise, is limited to 00017 this program in accordance with the express provisions of the 00018 GNU Lesser General Public License. 00019 00020 Patent licenses, if any, provided herein do not apply to combinations 00021 of this program with other product or programs, or any other product 00022 whatsoever. This program is distributed without any warranty that the 00023 program is delivered free of the rightful claim of any third person by 00024 way of infringement or the like. 00025 00026 See the GNU Lesser General Public License for more details. 00027 00028 You should have received a copy of the GNU General Public License along 00029 with this program; if not, write the Free Software Foundation, Inc., 59 00030 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00031 00032 */ 00033 00034 /* --------------------------------------------------- */ 00035 /* | All Rights Reserved. | */ 00036 /* --------------------------------------------------- */ 00037 /* $Header: /proj/osprey/CVS/open64/osprey1.0/libU77/alarm_.c,v 1.1.1.1 2005/10/21 19:00:00 marcel Exp $ */ 00038 /* $Header: /proj/osprey/CVS/open64/osprey1.0/libU77/alarm_.c,v 1.1.1.1 2005/10/21 19:00:00 marcel Exp $ */ 00039 /* 00040 * 00041 * set an alarm time, arrange for user specified action, and return. 00042 * 00043 * calling sequence: 00044 * integer flag 00045 * f77external alfunc 00046 * lastiv = alarm (intval, alfunc) 00047 * where: 00048 * intval = the alarm interval in seconds; 0 turns off the alarm. 00049 * alfunc = the function to be called after the alarm interval, 00050 * 00051 * The returned value will be the time remaining on the last alarm. 00052 */ 00053 00054 #include <unistd.h> 00055 #include <signal.h> 00056 00057 #ifdef KEY /* Bug 1683 */ 00058 00059 #include "pathf90_libU_intrin.h" 00060 00061 pathf90_i4 00062 pathf90_alarm(pathf90_i4 *sec,void (*proc)(), pathf90_i4 *status) 00063 { 00064 register unsigned lt; 00065 00066 lt = alarm(1000); /* time to maneuver */ 00067 00068 if (*sec) 00069 signal(SIGALRM, proc); 00070 00071 alarm(*sec); 00072 if (0 != status) { 00073 *status = lt; 00074 } 00075 return(lt); 00076 } 00077 00078 #else 00079 00080 extern int 00081 alarm_(int *sec, void (* proc)()) 00082 { 00083 register unsigned lt; 00084 00085 lt = alarm(1000); /* time to maneuver */ 00086 00087 if (*sec) 00088 signal(SIGALRM, proc); 00089 00090 alarm(*sec); 00091 return(lt); 00092 } 00093 #endif /* KEY Bug 1683 */
1.5.6