Mercurial > emacs
annotate src/atimer.c @ 112453:06719a229a46 default tip
* calc/calc.el (calc-default-power-reference-level)
(calc-default-field-reference-level): New variables.
* calc/calc-units.el (math-standard-units): Add dB and Np.
(math-logunits): New variable.
(math-extract-logunits, math-logcombine, calcFunc-luplus)
(calcFunc-luminus, calc-luplus, calc-luminus, math-logunit-level)
(calcFunc-fieldlevel, calcFunc-powerlevel, calc-level): New
functions.
(math-find-base-units-rec): Add entry for ln(10).
* calc/calc-help.el (calc-u-prefix-help): Add logarithmic help.
(calc-ul-prefix-help): New function.
* calc/calc-ext.el (calc-init-extensions): Autoload new units
functions. Add keybindings for new units functions.
| author | Jay Belanger <jay.p.belanger@gmail.com> |
|---|---|
| date | Sun, 23 Jan 2011 23:08:04 -0600 |
| parents | 56d3e9c28eb0 |
| children |
| rev | line source |
|---|---|
| 27433 | 1 /* Asynchronous timers. |
|
75227
e90d04cd455a
Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents:
68651
diff
changeset
|
2 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, |
|
112218
376148b31b5e
Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents:
111157
diff
changeset
|
3 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
| 27433 | 4 |
| 5 This file is part of GNU Emacs. | |
| 6 | |
|
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93894
diff
changeset
|
7 GNU Emacs is free software: you can redistribute it and/or modify |
| 27433 | 8 it under the terms of the GNU General Public License as published by |
|
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93894
diff
changeset
|
9 the Free Software Foundation, either version 3 of the License, or |
|
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93894
diff
changeset
|
10 (at your option) any later version. |
| 27433 | 11 |
| 12 GNU Emacs is distributed in the hope that it will be useful, | |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 GNU General Public License for more details. | |
| 16 | |
| 17 You should have received a copy of the GNU General Public License | |
|
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93894
diff
changeset
|
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 27433 | 19 |
| 20 #include <config.h> | |
|
53901
d85f8f2e71f7
Move include stdio.h to same place as in other files.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
21 #include <signal.h> |
|
d85f8f2e71f7
Move include stdio.h to same place as in other files.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
22 #include <stdio.h> |
|
105669
68dd71358159
* alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103104
diff
changeset
|
23 #include <setjmp.h> |
|
109140
3e48102ba93a
* src/atimer.c: Use "" instead of <> for local includes for
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109130
diff
changeset
|
24 #include "lisp.h" |
|
3e48102ba93a
* src/atimer.c: Use "" instead of <> for local includes for
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109130
diff
changeset
|
25 #include "syssignal.h" |
|
3e48102ba93a
* src/atimer.c: Use "" instead of <> for local includes for
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109130
diff
changeset
|
26 #include "systime.h" |
|
3e48102ba93a
* src/atimer.c: Use "" instead of <> for local includes for
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109130
diff
changeset
|
27 #include "blockinput.h" |
|
3e48102ba93a
* src/atimer.c: Use "" instead of <> for local includes for
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109130
diff
changeset
|
28 #include "atimer.h" |
| 27433 | 29 #include <unistd.h> |
| 30 | |
| 31 #ifdef HAVE_SYS_TIME_H | |
| 32 #include <sys/time.h> | |
| 33 #endif | |
| 34 | |
| 35 /* Free-list of atimer structures. */ | |
| 36 | |
| 37 static struct atimer *free_atimers; | |
| 38 | |
|
27670
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
39 /* List of currently not running timers due to a call to |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
40 lock_atimer. */ |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
41 |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
42 static struct atimer *stopped_atimers; |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
43 |
| 27433 | 44 /* List of active atimers, sorted by expiration time. The timer that |
| 45 will become ripe next is always at the front of this list. */ | |
| 46 | |
| 47 static struct atimer *atimers; | |
| 48 | |
| 49 /* Non-zero means alarm_signal_handler has found ripe timers but | |
| 50 interrupt_input_blocked was non-zero. In this case, timer | |
| 51 functions are not called until the next UNBLOCK_INPUT because timer | |
| 52 functions are expected to call X, and X cannot be assumed to be | |
| 53 reentrant. */ | |
| 54 | |
| 55 int pending_atimers; | |
| 56 | |
| 39667 | 57 /* Block/unblock SIGALRM. */ |
| 27433 | 58 |
| 59 #define BLOCK_ATIMERS sigblock (sigmask (SIGALRM)) | |
| 60 #define UNBLOCK_ATIMERS sigunblock (sigmask (SIGALRM)) | |
| 61 | |
| 62 /* Function prototypes. */ | |
| 63 | |
|
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
107460
diff
changeset
|
64 static void set_alarm (void); |
|
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
107460
diff
changeset
|
65 static void schedule_atimer (struct atimer *); |
|
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
107460
diff
changeset
|
66 static struct atimer *append_atimer_lists (struct atimer *, |
|
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
107460
diff
changeset
|
67 struct atimer *); |
|
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
68 SIGTYPE alarm_signal_handler (int signo); |
| 27433 | 69 |
| 70 | |
| 71 /* Start a new atimer of type TYPE. TIME specifies when the timer is | |
| 72 ripe. FN is the function to call when the timer fires. | |
| 73 CLIENT_DATA is stored in the client_data member of the atimer | |
| 74 structure returned and so made available to FN when it is called. | |
| 75 | |
| 76 If TYPE is ATIMER_ABSOLUTE, TIME is the absolute time at which the | |
| 77 timer fires. | |
| 78 | |
| 79 If TYPE is ATIMER_RELATIVE, the timer is ripe TIME s/us in the | |
| 80 future. | |
| 81 | |
| 82 In both cases, the timer is automatically freed after it has fired. | |
| 83 | |
| 84 If TYPE is ATIMER_CONTINUOUS, the timer fires every TIME s/us. | |
| 85 | |
| 86 Value is a pointer to the atimer started. It can be used in calls | |
| 87 to cancel_atimer; don't free it yourself. */ | |
| 88 | |
| 89 struct atimer * | |
|
109130
cd13b432f239
Fix more prototypes.
Juanma Barranquero <lekktu@gmail.com>
parents:
109126
diff
changeset
|
90 start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn, |
|
cd13b432f239
Fix more prototypes.
Juanma Barranquero <lekktu@gmail.com>
parents:
109126
diff
changeset
|
91 void *client_data) |
| 27433 | 92 { |
| 93 struct atimer *t; | |
| 94 | |
| 95 /* Round TIME up to the next full second if we don't have | |
| 96 itimers. */ | |
| 97 #ifndef HAVE_SETITIMER | |
| 98 if (EMACS_USECS (time) != 0) | |
| 99 { | |
|
27452
7580a16f676c
(start_atimer) [!HAVE_SETITIMER]: Use EMACS_SET_SECS
Eli Zaretskii <eliz@gnu.org>
parents:
27433
diff
changeset
|
100 EMACS_SET_USECS (time, 0); |
|
7580a16f676c
(start_atimer) [!HAVE_SETITIMER]: Use EMACS_SET_SECS
Eli Zaretskii <eliz@gnu.org>
parents:
27433
diff
changeset
|
101 EMACS_SET_SECS (time, EMACS_SECS (time) + 1); |
| 27433 | 102 } |
| 103 #endif /* not HAVE_SETITIMER */ | |
| 104 | |
| 105 /* Get an atimer structure from the free-list, or allocate | |
| 106 a new one. */ | |
| 107 if (free_atimers) | |
| 108 { | |
| 109 t = free_atimers; | |
| 110 free_atimers = t->next; | |
| 111 } | |
| 112 else | |
| 113 t = (struct atimer *) xmalloc (sizeof *t); | |
| 114 | |
| 115 /* Fill the atimer structure. */ | |
|
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109140
diff
changeset
|
116 memset (t, 0, sizeof *t); |
| 27433 | 117 t->type = type; |
| 118 t->fn = fn; | |
| 119 t->client_data = client_data; | |
| 120 | |
| 121 BLOCK_ATIMERS; | |
| 122 | |
| 123 /* Compute the timer's expiration time. */ | |
| 124 switch (type) | |
| 125 { | |
| 126 case ATIMER_ABSOLUTE: | |
| 127 t->expiration = time; | |
| 128 break; | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
129 |
| 27433 | 130 case ATIMER_RELATIVE: |
| 131 EMACS_GET_TIME (t->expiration); | |
| 132 EMACS_ADD_TIME (t->expiration, t->expiration, time); | |
| 133 break; | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
134 |
| 27433 | 135 case ATIMER_CONTINUOUS: |
| 136 EMACS_GET_TIME (t->expiration); | |
| 137 EMACS_ADD_TIME (t->expiration, t->expiration, time); | |
| 138 t->interval = time; | |
| 139 break; | |
| 140 } | |
| 141 | |
| 142 /* Insert the timer in the list of active atimers. */ | |
| 143 schedule_atimer (t); | |
| 144 UNBLOCK_ATIMERS; | |
| 145 | |
| 146 /* Arrange for a SIGALRM at the time the next atimer is ripe. */ | |
| 147 set_alarm (); | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
148 |
| 27433 | 149 return t; |
| 150 } | |
| 151 | |
| 152 | |
| 153 /* Cancel and free atimer TIMER. */ | |
| 154 | |
| 155 void | |
|
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
156 cancel_atimer (struct atimer *timer) |
| 27433 | 157 { |
|
27913
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
158 int i; |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
159 |
| 27433 | 160 BLOCK_ATIMERS; |
| 161 | |
|
27913
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
162 for (i = 0; i < 2; ++i) |
|
27903
cc3d4c12e03b
(cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents:
27734
diff
changeset
|
163 { |
|
27913
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
164 struct atimer *t, *prev; |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
165 struct atimer **list = i ? &stopped_atimers : &atimers; |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
166 |
|
27903
cc3d4c12e03b
(cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents:
27734
diff
changeset
|
167 /* See if TIMER is active or stopped. */ |
|
28119
98625ad8a015
(cancel_atimer): Break out of the loop as soon as timer
Gerd Moellmann <gerd@gnu.org>
parents:
27913
diff
changeset
|
168 for (t = *list, prev = NULL; t && t != timer; prev = t, t = t->next) |
|
27903
cc3d4c12e03b
(cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents:
27734
diff
changeset
|
169 ; |
| 27433 | 170 |
| 111157 | 171 /* If it is, take it off its list, and put in on the free-list. |
| 172 We don't bother to arrange for setting a different alarm time, | |
| 173 since a too early one doesn't hurt. */ | |
|
27903
cc3d4c12e03b
(cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents:
27734
diff
changeset
|
174 if (t) |
|
cc3d4c12e03b
(cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents:
27734
diff
changeset
|
175 { |
|
cc3d4c12e03b
(cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents:
27734
diff
changeset
|
176 if (prev) |
|
cc3d4c12e03b
(cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents:
27734
diff
changeset
|
177 prev->next = t->next; |
|
cc3d4c12e03b
(cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents:
27734
diff
changeset
|
178 else |
|
cc3d4c12e03b
(cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents:
27734
diff
changeset
|
179 *list = t->next; |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
180 |
|
27903
cc3d4c12e03b
(cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents:
27734
diff
changeset
|
181 t->next = free_atimers; |
|
cc3d4c12e03b
(cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents:
27734
diff
changeset
|
182 free_atimers = t; |
|
28119
98625ad8a015
(cancel_atimer): Break out of the loop as soon as timer
Gerd Moellmann <gerd@gnu.org>
parents:
27913
diff
changeset
|
183 break; |
|
27903
cc3d4c12e03b
(cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents:
27734
diff
changeset
|
184 } |
| 27433 | 185 } |
| 186 | |
| 187 UNBLOCK_ATIMERS; | |
| 188 } | |
| 189 | |
| 190 | |
|
27913
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
191 /* Append two lists of atimers LIST1 and LIST2 and return the |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
192 result list. */ |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
193 |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
194 static struct atimer * |
|
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
195 append_atimer_lists (struct atimer *list1, struct atimer *list2) |
|
27913
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
196 { |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
197 if (list1 == NULL) |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
198 return list2; |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
199 else if (list2 == NULL) |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
200 return list1; |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
201 else |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
202 { |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
203 struct atimer *p; |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
204 |
|
27913
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
205 for (p = list1; p->next; p = p->next) |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
206 ; |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
207 p->next = list2; |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
208 return list1; |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
209 } |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
210 } |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
211 |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
212 |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
213 /* Stop all timers except timer T. T null means stop all timers. */ |
|
27670
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
214 |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
215 void |
|
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
216 stop_other_atimers (struct atimer *t) |
|
27670
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
217 { |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
218 BLOCK_ATIMERS; |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
219 |
|
27670
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
220 if (t) |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
221 { |
|
27734
5c49b0be3b7b
(stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents:
27670
diff
changeset
|
222 struct atimer *p, *prev; |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
223 |
|
27734
5c49b0be3b7b
(stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents:
27670
diff
changeset
|
224 /* See if T is active. */ |
|
67209
a0e182783583
(stop_other_atimers): Fix loop to correctly compute `prev'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64770
diff
changeset
|
225 for (p = atimers, prev = NULL; p && p != t; prev = p, p = p->next) |
|
27734
5c49b0be3b7b
(stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents:
27670
diff
changeset
|
226 ; |
|
5c49b0be3b7b
(stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents:
27670
diff
changeset
|
227 |
|
5c49b0be3b7b
(stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents:
27670
diff
changeset
|
228 if (p == t) |
|
5c49b0be3b7b
(stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents:
27670
diff
changeset
|
229 { |
|
5c49b0be3b7b
(stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents:
27670
diff
changeset
|
230 if (prev) |
|
5c49b0be3b7b
(stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents:
27670
diff
changeset
|
231 prev->next = t->next; |
|
5c49b0be3b7b
(stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents:
27670
diff
changeset
|
232 else |
|
5c49b0be3b7b
(stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents:
27670
diff
changeset
|
233 atimers = t->next; |
|
5c49b0be3b7b
(stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents:
27670
diff
changeset
|
234 t->next = NULL; |
|
5c49b0be3b7b
(stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents:
27670
diff
changeset
|
235 } |
|
5c49b0be3b7b
(stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents:
27670
diff
changeset
|
236 else |
|
5c49b0be3b7b
(stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents:
27670
diff
changeset
|
237 /* T is not active. Let's handle this like T == 0. */ |
|
5c49b0be3b7b
(stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents:
27670
diff
changeset
|
238 t = NULL; |
|
27670
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
239 } |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
240 |
|
27913
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
241 stopped_atimers = append_atimer_lists (atimers, stopped_atimers); |
|
27670
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
242 atimers = t; |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
243 UNBLOCK_ATIMERS; |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
244 } |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
245 |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
246 |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
247 /* Run all timers again, if some have been stopped with a call to |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
248 stop_other_atimers. */ |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
249 |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
250 void |
|
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
251 run_all_atimers (void) |
|
27670
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
252 { |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
253 if (stopped_atimers) |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
254 { |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
255 struct atimer *t = atimers; |
|
27913
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
256 struct atimer *next; |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
257 |
|
27670
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
258 BLOCK_ATIMERS; |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
259 atimers = stopped_atimers; |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
260 stopped_atimers = NULL; |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
261 |
|
27913
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
262 while (t) |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
263 { |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
264 next = t->next; |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
265 schedule_atimer (t); |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
266 t = next; |
|
81d5641c8b04
(start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents:
27903
diff
changeset
|
267 } |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
268 |
|
27670
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
269 UNBLOCK_ATIMERS; |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
270 } |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
271 } |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
272 |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
273 |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
274 /* A version of run_all_timers suitable for a record_unwind_protect. */ |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
275 |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
276 Lisp_Object |
|
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
277 unwind_stop_other_atimers (Lisp_Object dummy) |
|
27670
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
278 { |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
279 run_all_atimers (); |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
280 return Qnil; |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
281 } |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
282 |
|
cf2edc15eaa9
(stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27452
diff
changeset
|
283 |
| 27433 | 284 /* Arrange for a SIGALRM to arrive when the next timer is ripe. */ |
| 285 | |
| 286 static void | |
|
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
287 set_alarm (void) |
| 27433 | 288 { |
| 289 if (atimers) | |
| 290 { | |
| 291 EMACS_TIME now, time; | |
| 292 #ifdef HAVE_SETITIMER | |
| 293 struct itimerval it; | |
| 294 #endif | |
| 295 | |
| 296 /* Determine s/us till the next timer is ripe. */ | |
| 297 EMACS_GET_TIME (now); | |
| 298 EMACS_SUB_TIME (time, atimers->expiration, now); | |
| 299 | |
| 300 #ifdef HAVE_SETITIMER | |
| 301 /* Don't set the interval to 0; this disables the timer. */ | |
| 302 if (EMACS_TIME_LE (atimers->expiration, now)) | |
| 303 { | |
| 304 EMACS_SET_SECS (time, 0); | |
| 305 EMACS_SET_USECS (time, 1000); | |
| 306 } | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
307 |
|
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109140
diff
changeset
|
308 memset (&it, 0, sizeof it); |
| 27433 | 309 it.it_value = time; |
| 310 setitimer (ITIMER_REAL, &it, 0); | |
| 311 #else /* not HAVE_SETITIMER */ | |
| 312 alarm (max (EMACS_SECS (time), 1)); | |
| 313 #endif /* not HAVE_SETITIMER */ | |
| 314 } | |
| 315 } | |
| 316 | |
| 317 | |
| 318 /* Insert timer T into the list of active atimers `atimers', keeping | |
| 319 the list sorted by expiration time. T must not be in this list | |
| 320 already. */ | |
| 321 | |
| 322 static void | |
|
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
323 schedule_atimer (struct atimer *t) |
| 27433 | 324 { |
| 325 struct atimer *a = atimers, *prev = NULL; | |
| 326 | |
| 327 /* Look for the first atimer that is ripe after T. */ | |
| 328 while (a && EMACS_TIME_GT (t->expiration, a->expiration)) | |
| 329 prev = a, a = a->next; | |
| 330 | |
| 331 /* Insert T in front of the atimer found, if any. */ | |
| 332 if (prev) | |
| 333 prev->next = t; | |
| 334 else | |
| 335 atimers = t; | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
336 |
| 27433 | 337 t->next = a; |
| 338 } | |
| 339 | |
|
93894
065fbf6b6fd0
(alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
79759
diff
changeset
|
340 static void |
|
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
341 run_timers (void) |
| 27433 | 342 { |
| 343 EMACS_TIME now; | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
344 |
| 27433 | 345 EMACS_GET_TIME (now); |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
346 |
| 27433 | 347 while (atimers |
| 348 && (pending_atimers = interrupt_input_blocked) == 0 | |
| 349 && EMACS_TIME_LE (atimers->expiration, now)) | |
| 350 { | |
| 351 struct atimer *t; | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
352 |
| 27433 | 353 t = atimers; |
| 354 atimers = atimers->next; | |
| 355 t->fn (t); | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
356 |
| 27433 | 357 if (t->type == ATIMER_CONTINUOUS) |
| 358 { | |
| 359 EMACS_ADD_TIME (t->expiration, now, t->interval); | |
| 360 schedule_atimer (t); | |
| 361 } | |
| 362 else | |
| 363 { | |
| 364 t->next = free_atimers; | |
| 365 free_atimers = t; | |
| 366 } | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
367 |
| 27433 | 368 EMACS_GET_TIME (now); |
| 369 } | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39687
diff
changeset
|
370 |
|
101847
b8c8f770feb3
(run_timers): Update pending_atimers.
Chong Yidong <cyd@stupidchicken.com>
parents:
101675
diff
changeset
|
371 if (! atimers) |
|
b8c8f770feb3
(run_timers): Update pending_atimers.
Chong Yidong <cyd@stupidchicken.com>
parents:
101675
diff
changeset
|
372 pending_atimers = 0; |
|
b8c8f770feb3
(run_timers): Update pending_atimers.
Chong Yidong <cyd@stupidchicken.com>
parents:
101675
diff
changeset
|
373 |
|
101675
9c67a492eb59
* atimer.c (run_timers, alarm_signal_handler):
Juanma Barranquero <lekktu@gmail.com>
parents:
101647
diff
changeset
|
374 #ifdef SYNC_INPUT |
|
101647
a802fb91191e
(run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
375 if (pending_atimers) |
|
a802fb91191e
(run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
376 pending_signals = 1; |
|
a802fb91191e
(run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
377 else |
|
a802fb91191e
(run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
378 { |
|
a802fb91191e
(run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
379 pending_signals = interrupt_input_pending; |
|
a802fb91191e
(run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
380 set_alarm (); |
|
a802fb91191e
(run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
381 } |
|
101675
9c67a492eb59
* atimer.c (run_timers, alarm_signal_handler):
Juanma Barranquero <lekktu@gmail.com>
parents:
101647
diff
changeset
|
382 #else |
|
9c67a492eb59
* atimer.c (run_timers, alarm_signal_handler):
Juanma Barranquero <lekktu@gmail.com>
parents:
101647
diff
changeset
|
383 if (! pending_atimers) |
|
9c67a492eb59
* atimer.c (run_timers, alarm_signal_handler):
Juanma Barranquero <lekktu@gmail.com>
parents:
101647
diff
changeset
|
384 set_alarm (); |
|
9c67a492eb59
* atimer.c (run_timers, alarm_signal_handler):
Juanma Barranquero <lekktu@gmail.com>
parents:
101647
diff
changeset
|
385 #endif |
| 27433 | 386 } |
| 387 | |
| 388 | |
|
93894
065fbf6b6fd0
(alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
79759
diff
changeset
|
389 /* Signal handler for SIGALRM. SIGNO is the signal number, i.e. |
|
065fbf6b6fd0
(alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
79759
diff
changeset
|
390 SIGALRM. */ |
|
065fbf6b6fd0
(alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
79759
diff
changeset
|
391 |
|
065fbf6b6fd0
(alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
79759
diff
changeset
|
392 SIGTYPE |
|
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
393 alarm_signal_handler (int signo) |
|
93894
065fbf6b6fd0
(alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
79759
diff
changeset
|
394 { |
|
106814
84369111c005
Call SIGNAL_THREAD_CHECK from signal handlers.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
105669
diff
changeset
|
395 #ifndef SYNC_INPUT |
|
84369111c005
Call SIGNAL_THREAD_CHECK from signal handlers.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
105669
diff
changeset
|
396 SIGNAL_THREAD_CHECK (signo); |
|
84369111c005
Call SIGNAL_THREAD_CHECK from signal handlers.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
105669
diff
changeset
|
397 #endif |
|
84369111c005
Call SIGNAL_THREAD_CHECK from signal handlers.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
105669
diff
changeset
|
398 |
|
93894
065fbf6b6fd0
(alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
79759
diff
changeset
|
399 pending_atimers = 1; |
|
101675
9c67a492eb59
* atimer.c (run_timers, alarm_signal_handler):
Juanma Barranquero <lekktu@gmail.com>
parents:
101647
diff
changeset
|
400 #ifdef SYNC_INPUT |
|
101647
a802fb91191e
(run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
401 pending_signals = 1; |
|
101675
9c67a492eb59
* atimer.c (run_timers, alarm_signal_handler):
Juanma Barranquero <lekktu@gmail.com>
parents:
101647
diff
changeset
|
402 #else |
|
93894
065fbf6b6fd0
(alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
79759
diff
changeset
|
403 run_timers (); |
|
065fbf6b6fd0
(alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
79759
diff
changeset
|
404 #endif |
|
065fbf6b6fd0
(alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
79759
diff
changeset
|
405 } |
|
065fbf6b6fd0
(alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
79759
diff
changeset
|
406 |
|
065fbf6b6fd0
(alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
79759
diff
changeset
|
407 |
| 27433 | 408 /* Call alarm_signal_handler for pending timers. */ |
| 409 | |
| 410 void | |
|
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
411 do_pending_atimers (void) |
| 27433 | 412 { |
| 413 if (pending_atimers) | |
| 414 { | |
| 415 BLOCK_ATIMERS; | |
|
93894
065fbf6b6fd0
(alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
79759
diff
changeset
|
416 run_timers (); |
| 27433 | 417 UNBLOCK_ATIMERS; |
| 418 } | |
| 419 } | |
| 420 | |
| 421 | |
| 422 /* Turn alarms on/off. This seems to be temporarily necessary on | |
| 423 some systems like HPUX (see process.c). */ | |
| 424 | |
| 425 void | |
|
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
426 turn_on_atimers (int on) |
| 27433 | 427 { |
| 428 if (on) | |
| 429 { | |
| 430 signal (SIGALRM, alarm_signal_handler); | |
| 431 set_alarm (); | |
| 432 } | |
| 433 else | |
| 434 alarm (0); | |
| 435 } | |
| 436 | |
| 437 | |
| 438 void | |
|
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
439 init_atimer (void) |
| 27433 | 440 { |
|
103104
2380af35be5c
(init_atimer): Also clear stopped_atimers.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
101847
diff
changeset
|
441 free_atimers = stopped_atimers = atimers = NULL; |
| 27433 | 442 pending_atimers = 0; |
|
101647
a802fb91191e
(run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
443 /* pending_signals is initialized in init_keyboard.*/ |
| 27433 | 444 signal (SIGALRM, alarm_signal_handler); |
| 445 } | |
| 52401 | 446 |
