annotate src/atimer.c @ 110507:875202ac5b45

Fix use of int instead of EMACS_INT in search.c and region-cache.c. indent.c (compute_motion): Use EMACS_INT for arguments to region_cache_forward. region-cache.c (struct boundary, struct region_cache): Use EMACS_INT for positions. (find_cache_boundary, move_cache_gap, insert_cache_boundary) (delete_cache_boundaries, set_cache_region) (invalidate_region_cache, know_region_cache) (region_cache_forward, region_cache_backward, pp_cache): Use EMACS_INT for buffer positions. region-cache.h (know_region_cache, invalidate_region_cache) (region_cache_forward, region_cache_backward): Adjust prototypes. search.c (string_match_1, fast_c_string_match_ignore_case) (looking_at_1, scan_buffer, scan_newline) (find_next_newline_no_quit, find_before_next_newline) (search_command, trivial_regexp_p, search_buffer, simple_search) (boyer_moore, wordify, Freplace_match): Use EMACS_INT for buffer and string positions and length. lisp.h (scan_buffer, scan_newline, find_next_newline_no_quit) (find_before_next_newline): Adjust prototypes.
author Eli Zaretskii <eliz@gnu.org>
date Thu, 23 Sep 2010 14:35:11 -0400
parents 750db9f3e6d8
children bf6806de6892
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
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,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106814
diff changeset
3 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
4
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5 This file is part of GNU Emacs.
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
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
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
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
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 GNU General Public License for more details.
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
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
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
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
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30 #ifdef HAVE_UNISTD_H
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 #include <unistd.h>
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32 #endif
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34 #ifdef HAVE_SYS_TIME_H
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35 #include <sys/time.h>
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36 #endif
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38 /* Free-list of atimer structures. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
40 static struct atimer *free_atimers;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41
27670
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
42 /* 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
43 lock_atimer. */
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
44
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
45 static struct atimer *stopped_atimers;
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
46
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47 /* List of active atimers, sorted by expiration time. The timer that
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
48 will become ripe next is always at the front of this list. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 static struct atimer *atimers;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 /* Non-zero means alarm_signal_handler has found ripe timers but
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 interrupt_input_blocked was non-zero. In this case, timer
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 functions are not called until the next UNBLOCK_INPUT because timer
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 functions are expected to call X, and X cannot be assumed to be
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56 reentrant. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
58 int pending_atimers;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
59
39667
7ca787d18982 *** empty log message ***
Pavel Janík <Pavel@Janik.cz>
parents: 29672
diff changeset
60 /* Block/unblock SIGALRM. */
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
62 #define BLOCK_ATIMERS sigblock (sigmask (SIGALRM))
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63 #define UNBLOCK_ATIMERS sigunblock (sigmask (SIGALRM))
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65 /* Function prototypes. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66
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
67 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
68 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
69 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
70 struct atimer *);
109126
aec1143e8d85 Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109100
diff changeset
71 SIGTYPE alarm_signal_handler (int signo);
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 /* Start a new atimer of type TYPE. TIME specifies when the timer is
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
75 ripe. FN is the function to call when the timer fires.
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76 CLIENT_DATA is stored in the client_data member of the atimer
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 structure returned and so made available to FN when it is called.
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
78
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79 If TYPE is ATIMER_ABSOLUTE, TIME is the absolute time at which the
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80 timer fires.
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 If TYPE is ATIMER_RELATIVE, the timer is ripe TIME s/us in the
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 future.
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 In both cases, the timer is automatically freed after it has fired.
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87 If TYPE is ATIMER_CONTINUOUS, the timer fires every TIME s/us.
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
88
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89 Value is a pointer to the atimer started. It can be used in calls
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 to cancel_atimer; don't free it yourself. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
92 struct atimer *
109130
cd13b432f239 Fix more prototypes.
Juanma Barranquero <lekktu@gmail.com>
parents: 109126
diff changeset
93 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
94 void *client_data)
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
95 {
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96 struct atimer *t;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
97
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
98 /* Round TIME up to the next full second if we don't have
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 itimers. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 #ifndef HAVE_SETITIMER
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101 if (EMACS_USECS (time) != 0)
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102 {
27452
7580a16f676c (start_atimer) [!HAVE_SETITIMER]: Use EMACS_SET_SECS
Eli Zaretskii <eliz@gnu.org>
parents: 27433
diff changeset
103 EMACS_SET_USECS (time, 0);
7580a16f676c (start_atimer) [!HAVE_SETITIMER]: Use EMACS_SET_SECS
Eli Zaretskii <eliz@gnu.org>
parents: 27433
diff changeset
104 EMACS_SET_SECS (time, EMACS_SECS (time) + 1);
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 }
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
106 #endif /* not HAVE_SETITIMER */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
107
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
108 /* Get an atimer structure from the free-list, or allocate
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109 a new one. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
110 if (free_atimers)
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 {
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112 t = free_atimers;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 free_atimers = t->next;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114 }
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
115 else
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
116 t = (struct atimer *) xmalloc (sizeof *t);
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
117
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
118 /* 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
119 memset (t, 0, sizeof *t);
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
120 t->type = type;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
121 t->fn = fn;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
122 t->client_data = client_data;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
124 BLOCK_ATIMERS;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
125
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
126 /* Compute the timer's expiration time. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 switch (type)
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
128 {
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
129 case ATIMER_ABSOLUTE:
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
130 t->expiration = time;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
131 break;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
132
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 case ATIMER_RELATIVE:
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
134 EMACS_GET_TIME (t->expiration);
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
135 EMACS_ADD_TIME (t->expiration, t->expiration, time);
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
136 break;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
137
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
138 case ATIMER_CONTINUOUS:
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
139 EMACS_GET_TIME (t->expiration);
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
140 EMACS_ADD_TIME (t->expiration, t->expiration, time);
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
141 t->interval = time;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
142 break;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
143 }
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
144
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
145 /* Insert the timer in the list of active atimers. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
146 schedule_atimer (t);
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
147 UNBLOCK_ATIMERS;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
148
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
149 /* Arrange for a SIGALRM at the time the next atimer is ripe. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
150 set_alarm ();
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
151
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
152 return t;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
153 }
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
154
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
155
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
156 /* Cancel and free atimer TIMER. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
157
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
158 void
109126
aec1143e8d85 Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109100
diff changeset
159 cancel_atimer (struct atimer *timer)
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
160 {
27913
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
161 int i;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
162
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
163 BLOCK_ATIMERS;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
164
27913
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
165 for (i = 0; i < 2; ++i)
27903
cc3d4c12e03b (cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents: 27734
diff changeset
166 {
27913
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
167 struct atimer *t, *prev;
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
168 struct atimer **list = i ? &stopped_atimers : &atimers;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
169
27903
cc3d4c12e03b (cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents: 27734
diff changeset
170 /* 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
171 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
172 ;
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
173
27913
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
174 /* If it is, take it off the its list, and put in on the
27903
cc3d4c12e03b (cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents: 27734
diff changeset
175 free-list. We don't bother to arrange for setting a
cc3d4c12e03b (cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents: 27734
diff changeset
176 different alarm time, since a too early one doesn't hurt. */
cc3d4c12e03b (cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents: 27734
diff changeset
177 if (t)
cc3d4c12e03b (cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents: 27734
diff changeset
178 {
cc3d4c12e03b (cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents: 27734
diff changeset
179 if (prev)
cc3d4c12e03b (cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents: 27734
diff changeset
180 prev->next = t->next;
cc3d4c12e03b (cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents: 27734
diff changeset
181 else
cc3d4c12e03b (cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents: 27734
diff changeset
182 *list = t->next;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
183
27903
cc3d4c12e03b (cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents: 27734
diff changeset
184 t->next = free_atimers;
cc3d4c12e03b (cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents: 27734
diff changeset
185 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
186 break;
27903
cc3d4c12e03b (cancel_atimer): Handle canceling an atimer when
Gerd Moellmann <gerd@gnu.org>
parents: 27734
diff changeset
187 }
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
188 }
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
189
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
190 UNBLOCK_ATIMERS;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
191 }
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
192
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
193
27913
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
194 /* 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
195 result list. */
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 static struct atimer *
109126
aec1143e8d85 Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109100
diff changeset
198 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
199 {
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
200 if (list1 == NULL)
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
201 return list2;
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
202 else if (list2 == NULL)
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
203 return list1;
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
204 else
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
205 {
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
206 struct atimer *p;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
207
27913
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
208 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
209 ;
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
210 p->next = list2;
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
211 return list1;
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 }
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
214
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
215
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
216 /* 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
217
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
218 void
109126
aec1143e8d85 Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109100
diff changeset
219 stop_other_atimers (struct atimer *t)
27670
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
220 {
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
221 BLOCK_ATIMERS;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
222
27670
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
223 if (t)
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
224 {
27734
5c49b0be3b7b (stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents: 27670
diff changeset
225 struct atimer *p, *prev;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
226
27734
5c49b0be3b7b (stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents: 27670
diff changeset
227 /* 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
228 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
229 ;
5c49b0be3b7b (stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents: 27670
diff changeset
230
5c49b0be3b7b (stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents: 27670
diff changeset
231 if (p == t)
5c49b0be3b7b (stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents: 27670
diff changeset
232 {
5c49b0be3b7b (stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents: 27670
diff changeset
233 if (prev)
5c49b0be3b7b (stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents: 27670
diff changeset
234 prev->next = t->next;
5c49b0be3b7b (stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents: 27670
diff changeset
235 else
5c49b0be3b7b (stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents: 27670
diff changeset
236 atimers = t->next;
5c49b0be3b7b (stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents: 27670
diff changeset
237 t->next = NULL;
5c49b0be3b7b (stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents: 27670
diff changeset
238 }
5c49b0be3b7b (stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents: 27670
diff changeset
239 else
5c49b0be3b7b (stop_other_atimers): Don't call cancel_atimer because
Gerd Moellmann <gerd@gnu.org>
parents: 27670
diff changeset
240 /* 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
241 t = NULL;
27670
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
242 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
243
27913
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
244 stopped_atimers = append_atimer_lists (atimers, stopped_atimers);
27670
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
245 atimers = t;
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
246 UNBLOCK_ATIMERS;
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
247 }
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
248
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 /* 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
251 stop_other_atimers. */
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 void
109126
aec1143e8d85 Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109100
diff changeset
254 run_all_atimers (void)
27670
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
255 {
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
256 if (stopped_atimers)
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
257 {
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
258 struct atimer *t = atimers;
27913
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
259 struct atimer *next;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
260
27670
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
261 BLOCK_ATIMERS;
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
262 atimers = stopped_atimers;
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
263 stopped_atimers = NULL;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
264
27913
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
265 while (t)
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
266 {
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
267 next = t->next;
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
268 schedule_atimer (t);
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
269 t = next;
81d5641c8b04 (start_atimer): Don't abort when timers are stopped.
Gerd Moellmann <gerd@gnu.org>
parents: 27903
diff changeset
270 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
271
27670
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
272 UNBLOCK_ATIMERS;
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 }
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
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
277 /* 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
278
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
279 Lisp_Object
109126
aec1143e8d85 Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109100
diff changeset
280 unwind_stop_other_atimers (Lisp_Object dummy)
27670
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 run_all_atimers ();
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
283 return Qnil;
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
284 }
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
285
cf2edc15eaa9 (stopped_atimers): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 27452
diff changeset
286
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
287 /* Arrange for a SIGALRM to arrive when the next timer is ripe. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
288
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
289 static void
109126
aec1143e8d85 Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109100
diff changeset
290 set_alarm (void)
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
291 {
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
292 if (atimers)
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
293 {
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
294 EMACS_TIME now, time;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
295 #ifdef HAVE_SETITIMER
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
296 struct itimerval it;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
297 #endif
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
298
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
299 /* Determine s/us till the next timer is ripe. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
300 EMACS_GET_TIME (now);
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
301 EMACS_SUB_TIME (time, atimers->expiration, now);
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
302
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
303 #ifdef HAVE_SETITIMER
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
304 /* Don't set the interval to 0; this disables the timer. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
305 if (EMACS_TIME_LE (atimers->expiration, now))
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
306 {
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
307 EMACS_SET_SECS (time, 0);
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
308 EMACS_SET_USECS (time, 1000);
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
309 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
310
109165
750db9f3e6d8 Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents: 109140
diff changeset
311 memset (&it, 0, sizeof it);
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
312 it.it_value = time;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
313 setitimer (ITIMER_REAL, &it, 0);
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
314 #else /* not HAVE_SETITIMER */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
315 alarm (max (EMACS_SECS (time), 1));
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
316 #endif /* not HAVE_SETITIMER */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
317 }
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
318 }
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
319
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
320
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
321 /* Insert timer T into the list of active atimers `atimers', keeping
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
322 the list sorted by expiration time. T must not be in this list
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
323 already. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
324
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
325 static void
109126
aec1143e8d85 Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109100
diff changeset
326 schedule_atimer (struct atimer *t)
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
327 {
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
328 struct atimer *a = atimers, *prev = NULL;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
329
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
330 /* Look for the first atimer that is ripe after T. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
331 while (a && EMACS_TIME_GT (t->expiration, a->expiration))
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
332 prev = a, a = a->next;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
333
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
334 /* Insert T in front of the atimer found, if any. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
335 if (prev)
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
336 prev->next = t;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
337 else
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
338 atimers = t;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
339
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
340 t->next = a;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
341 }
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
342
93894
065fbf6b6fd0 (alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Djärv <jan.h.d@swipnet.se>
parents: 79759
diff changeset
343 static void
109126
aec1143e8d85 Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109100
diff changeset
344 run_timers (void)
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
345 {
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
346 EMACS_TIME now;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
347
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
348 EMACS_GET_TIME (now);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
349
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
350 while (atimers
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
351 && (pending_atimers = interrupt_input_blocked) == 0
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
352 && EMACS_TIME_LE (atimers->expiration, now))
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
353 {
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
354 struct atimer *t;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
355
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
356 t = atimers;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
357 atimers = atimers->next;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
358 t->fn (t);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
359
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
360 if (t->type == ATIMER_CONTINUOUS)
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
361 {
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
362 EMACS_ADD_TIME (t->expiration, now, t->interval);
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
363 schedule_atimer (t);
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
364 }
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
365 else
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
366 {
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
367 t->next = free_atimers;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
368 free_atimers = t;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
369 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
370
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
371 EMACS_GET_TIME (now);
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
372 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39687
diff changeset
373
101847
b8c8f770feb3 (run_timers): Update pending_atimers.
Chong Yidong <cyd@stupidchicken.com>
parents: 101675
diff changeset
374 if (! atimers)
b8c8f770feb3 (run_timers): Update pending_atimers.
Chong Yidong <cyd@stupidchicken.com>
parents: 101675
diff changeset
375 pending_atimers = 0;
b8c8f770feb3 (run_timers): Update pending_atimers.
Chong Yidong <cyd@stupidchicken.com>
parents: 101675
diff changeset
376
101675
9c67a492eb59 * atimer.c (run_timers, alarm_signal_handler):
Juanma Barranquero <lekktu@gmail.com>
parents: 101647
diff changeset
377 #ifdef SYNC_INPUT
101647
a802fb91191e (run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents: 100951
diff changeset
378 if (pending_atimers)
a802fb91191e (run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents: 100951
diff changeset
379 pending_signals = 1;
a802fb91191e (run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents: 100951
diff changeset
380 else
a802fb91191e (run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents: 100951
diff changeset
381 {
a802fb91191e (run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents: 100951
diff changeset
382 pending_signals = interrupt_input_pending;
a802fb91191e (run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents: 100951
diff changeset
383 set_alarm ();
a802fb91191e (run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents: 100951
diff changeset
384 }
101675
9c67a492eb59 * atimer.c (run_timers, alarm_signal_handler):
Juanma Barranquero <lekktu@gmail.com>
parents: 101647
diff changeset
385 #else
9c67a492eb59 * atimer.c (run_timers, alarm_signal_handler):
Juanma Barranquero <lekktu@gmail.com>
parents: 101647
diff changeset
386 if (! pending_atimers)
9c67a492eb59 * atimer.c (run_timers, alarm_signal_handler):
Juanma Barranquero <lekktu@gmail.com>
parents: 101647
diff changeset
387 set_alarm ();
9c67a492eb59 * atimer.c (run_timers, alarm_signal_handler):
Juanma Barranquero <lekktu@gmail.com>
parents: 101647
diff changeset
388 #endif
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
389 }
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
390
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
391
93894
065fbf6b6fd0 (alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Djärv <jan.h.d@swipnet.se>
parents: 79759
diff changeset
392 /* 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
393 SIGALRM. */
065fbf6b6fd0 (alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Djärv <jan.h.d@swipnet.se>
parents: 79759
diff changeset
394
065fbf6b6fd0 (alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Djärv <jan.h.d@swipnet.se>
parents: 79759
diff changeset
395 SIGTYPE
109126
aec1143e8d85 Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109100
diff changeset
396 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
397 {
106814
84369111c005 Call SIGNAL_THREAD_CHECK from signal handlers.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents: 105669
diff changeset
398 #ifndef SYNC_INPUT
84369111c005 Call SIGNAL_THREAD_CHECK from signal handlers.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents: 105669
diff changeset
399 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
400 #endif
84369111c005 Call SIGNAL_THREAD_CHECK from signal handlers.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents: 105669
diff changeset
401
93894
065fbf6b6fd0 (alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Djärv <jan.h.d@swipnet.se>
parents: 79759
diff changeset
402 pending_atimers = 1;
101675
9c67a492eb59 * atimer.c (run_timers, alarm_signal_handler):
Juanma Barranquero <lekktu@gmail.com>
parents: 101647
diff changeset
403 #ifdef SYNC_INPUT
101647
a802fb91191e (run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents: 100951
diff changeset
404 pending_signals = 1;
101675
9c67a492eb59 * atimer.c (run_timers, alarm_signal_handler):
Juanma Barranquero <lekktu@gmail.com>
parents: 101647
diff changeset
405 #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
406 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
407 #endif
065fbf6b6fd0 (alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Djärv <jan.h.d@swipnet.se>
parents: 79759
diff changeset
408 }
065fbf6b6fd0 (alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Djärv <jan.h.d@swipnet.se>
parents: 79759
diff changeset
409
065fbf6b6fd0 (alarm_signal_handler): Call run_timers if not SYNC_INPUT.
Jan Djärv <jan.h.d@swipnet.se>
parents: 79759
diff changeset
410
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
411 /* Call alarm_signal_handler for pending timers. */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
412
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
413 void
109126
aec1143e8d85 Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109100
diff changeset
414 do_pending_atimers (void)
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
415 {
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
416 if (pending_atimers)
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
417 {
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
418 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
419 run_timers ();
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
420 UNBLOCK_ATIMERS;
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
421 }
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
422 }
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
423
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
424
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
425 /* Turn alarms on/off. This seems to be temporarily necessary on
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
426 some systems like HPUX (see process.c). */
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
427
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
428 void
109126
aec1143e8d85 Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109100
diff changeset
429 turn_on_atimers (int on)
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
430 {
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
431 if (on)
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
432 {
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
433 signal (SIGALRM, alarm_signal_handler);
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
434 set_alarm ();
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
435 }
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
436 else
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
437 alarm (0);
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
438 }
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
439
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
440
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
441 void
109126
aec1143e8d85 Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109100
diff changeset
442 init_atimer (void)
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
443 {
103104
2380af35be5c (init_atimer): Also clear stopped_atimers.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents: 101847
diff changeset
444 free_atimers = stopped_atimers = atimers = NULL;
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
445 pending_atimers = 0;
101647
a802fb91191e (run_timers, alarm_signal_handler): Update pending_signals.
Chong Yidong <cyd@stupidchicken.com>
parents: 100951
diff changeset
446 /* pending_signals is initialized in init_keyboard.*/
27433
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
447 signal (SIGALRM, alarm_signal_handler);
87dcc6a2c31b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
448 }
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
449
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
450 /* arch-tag: e6308261-eec6-404b-89fb-6e5909518d70
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
451 (do not change this comment) */