4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Vim may haing until CTRL-C is typed when using CTRL-Z.
12 Solution: Avoid using pause(). Also use "volatile" for variables used in
13 signal functions. (Dominique Pelle)
14 Files: src/auto/configure, src/configure.in, src/config.h.in,
15 src/globals.h, src/os_unix.c
18 *** ../vim-7.2.129/src/auto/configure Thu Nov 20 10:36:04 2008
19 --- src/auto/configure Mon Mar 2 02:36:52 2009
26 + { $as_echo "$as_me:$LINENO: checking for working volatile" >&5
27 + $as_echo_n "checking for working volatile... " >&6; }
28 + if test "${ac_cv_c_volatile+set}" = set; then
29 + $as_echo_n "(cached) " >&6
31 + cat >conftest.$ac_ext <<_ACEOF
34 + cat confdefs.h >>conftest.$ac_ext
35 + cat >>conftest.$ac_ext <<_ACEOF
36 + /* end confdefs.h. */
43 + int * volatile y = (int *) 0;
49 + rm -f conftest.$ac_objext
50 + if { (ac_try="$ac_compile"
52 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
53 + *) ac_try_echo=$ac_try;;
55 + eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
56 + $as_echo "$ac_try_echo") >&5
57 + (eval "$ac_compile") 2>conftest.er1
59 + grep -v '^ *+' conftest.er1 >conftest.err
61 + cat conftest.err >&5
62 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
63 + (exit $ac_status); } && {
64 + test -z "$ac_c_werror_flag" ||
65 + test ! -s conftest.err
66 + } && test -s conftest.$ac_objext; then
67 + ac_cv_c_volatile=yes
69 + $as_echo "$as_me: failed program was:" >&5
70 + sed 's/^/| /' conftest.$ac_ext >&5
75 + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
77 + { $as_echo "$as_me:$LINENO: result: $ac_cv_c_volatile" >&5
78 + $as_echo "$ac_cv_c_volatile" >&6; }
79 + if test $ac_cv_c_volatile = no; then
81 + cat >>confdefs.h <<\_ACEOF
82 + #define volatile /**/
87 { $as_echo "$as_me:$LINENO: checking for mode_t" >&5
88 $as_echo_n "checking for mode_t... " >&6; }
89 if test "${ac_cv_type_mode_t+set}" = set; then
90 *** ../vim-7.2.129/src/configure.in Thu Nov 20 10:36:04 2008
91 --- src/configure.in Sun Feb 22 21:47:44 2009
95 dnl Checks for typedefs, structures, and compiler characteristics.
96 AC_PROG_GCC_TRADITIONAL
102 *** ../vim-7.2.129/src/config.h.in Tue Jun 24 23:47:46 2008
103 --- src/config.h.in Mon Feb 23 00:13:17 2009
107 /* Define to empty if the keyword does not work. */
110 + /* Define to empty if the keyword does not work. */
113 /* Define to `int' if <sys/types.h> doesn't define. */
116 *** ../vim-7.2.129/src/globals.h Tue Jan 6 16:13:42 2009
117 --- src/globals.h Mon Mar 2 02:40:16 2009
121 * While executing external commands or in Ex mode, should not insert GUI
122 * events in the input buffer: Set hold_gui_events to non-zero.
124 ! EXTERN int hold_gui_events INIT(= 0);
127 * When resizing the shell is postponed, remember the new size, and call
130 * While executing external commands or in Ex mode, should not insert GUI
131 * events in the input buffer: Set hold_gui_events to non-zero.
133 + * volatile because it is used in signal handler sig_sysmouse().
135 ! EXTERN volatile int hold_gui_events INIT(= 0);
138 * When resizing the shell is postponed, remember the new size, and call
141 EXTERN int really_exiting INIT(= FALSE);
142 /* TRUE when we are sure to exit, e.g., after
144 ! EXTERN int full_screen INIT(= FALSE);
145 /* TRUE when doing full-screen output
146 * otherwise only writing some messages */
149 EXTERN int really_exiting INIT(= FALSE);
150 /* TRUE when we are sure to exit, e.g., after
152 ! /* volatile because it is used in signal handler deathtrap(). */
153 ! EXTERN volatile int full_screen INIT(= FALSE);
154 /* TRUE when doing full-screen output
155 * otherwise only writing some messages */
160 EXTERN JMP_BUF lc_jump_env; /* argument to SETJMP() */
162 ! EXTERN int lc_signal; /* catched signal number, 0 when no was signal
163 ! catched; used for mch_libcall() */
165 ! EXTERN int lc_active INIT(= FALSE); /* TRUE when lc_jump_env is valid. */
168 #if defined(FEAT_MBYTE) || defined(FEAT_POSTSCRIPT)
171 EXTERN JMP_BUF lc_jump_env; /* argument to SETJMP() */
173 ! /* volatile because it is used in signal handlers. */
174 ! EXTERN volatile int lc_signal; /* caught signal number, 0 when no was signal
175 ! caught; used for mch_libcall() */
177 ! /* volatile because it is used in signal handler deathtrap(). */
178 ! EXTERN volatile int lc_active INIT(= FALSE); /* TRUE when lc_jump_env is valid. */
181 #if defined(FEAT_MBYTE) || defined(FEAT_POSTSCRIPT)
184 EXTERN FILE *scriptout INIT(= NULL); /* stream to write script to */
185 EXTERN int read_cmd_fd INIT(= 0); /* fd to read commands from */
187 ! EXTERN int got_int INIT(= FALSE); /* set to TRUE when interrupt
189 #ifdef USE_TERM_CONSOLE
190 EXTERN int term_console INIT(= FALSE); /* set to TRUE when console used */
192 EXTERN FILE *scriptout INIT(= NULL); /* stream to write script to */
193 EXTERN int read_cmd_fd INIT(= 0); /* fd to read commands from */
195 ! /* volatile because it is used in signal handler catch_sigint(). */
196 ! EXTERN volatile int got_int INIT(= FALSE); /* set to TRUE when interrupt
198 #ifdef USE_TERM_CONSOLE
199 EXTERN int term_console INIT(= FALSE); /* set to TRUE when console used */
200 *** ../vim-7.2.129/src/os_unix.c Sun Feb 22 02:51:37 2009
201 --- src/os_unix.c Mon Mar 2 01:05:50 2009
204 && defined(FEAT_TITLE) && !defined(FEAT_GUI_GTK)
205 # define SET_SIG_ALARM
206 static RETSIGTYPE sig_alarm __ARGS(SIGPROTOARG);
207 ! static int sig_alarm_called;
209 static RETSIGTYPE deathtrap __ARGS(SIGPROTOARG);
212 && defined(FEAT_TITLE) && !defined(FEAT_GUI_GTK)
213 # define SET_SIG_ALARM
214 static RETSIGTYPE sig_alarm __ARGS(SIGPROTOARG);
215 ! /* volatile because it is used in signal handler sig_alarm(). */
216 ! static volatile int sig_alarm_called;
218 static RETSIGTYPE deathtrap __ARGS(SIGPROTOARG);
222 # define SIG_ERR ((RETSIGTYPE (*)())-1)
225 ! static int do_resize = FALSE;
227 static char_u *extra_shell_arg = NULL;
228 static int show_shell_mess = TRUE;
230 ! static int deadly_signal = 0; /* The signal we caught */
231 ! static int in_mch_delay = FALSE; /* sleeping in mch_delay() */
233 static int curr_tmode = TMODE_COOK; /* contains current terminal mode */
236 # define SIG_ERR ((RETSIGTYPE (*)())-1)
239 ! /* volatile because it is used in signal handler sig_winch(). */
240 ! static volatile int do_resize = FALSE;
242 static char_u *extra_shell_arg = NULL;
243 static int show_shell_mess = TRUE;
245 ! /* volatile because it is used in signal handler deathtrap(). */
246 ! static volatile int deadly_signal = 0; /* The signal we caught */
247 ! /* volatile because it is used in signal handler deathtrap(). */
248 ! static volatile int in_mch_delay = FALSE; /* sleeping in mch_delay() */
250 static int curr_tmode = TMODE_COOK; /* contains current terminal mode */
257 ! * We need correct potatotypes for a signal function, otherwise mean compilers
258 * will barf when the second argument to signal() is ``wrong''.
259 * Let me try it with a few tricky defines from my own osdef.h (jw).
265 ! * We need correct prototypes for a signal function, otherwise mean compilers
266 * will barf when the second argument to signal() is ``wrong''.
267 * Let me try it with a few tricky defines from my own osdef.h (jw).
276 * On Solaris with multi-threading, suspending might not work immediately.
277 * Catch the SIGCONT signal, which will be used as an indication whether the
278 * suspending has been done or not.
280 ! static int sigcont_received;
281 static RETSIGTYPE sigcont_handler __ARGS(SIGPROTOARG);
288 ! #if defined(_REENTRANT) && defined(SIGCONT)
290 * On Solaris with multi-threading, suspending might not work immediately.
291 * Catch the SIGCONT signal, which will be used as an indication whether the
292 * suspending has been done or not.
294 + * On Linux, signal is not always handled immediately either.
295 + * See https://bugs.launchpad.net/bugs/291373
297 + * volatile because it is used in in signal handler sigcont_handler().
299 ! static volatile int sigcont_received;
300 static RETSIGTYPE sigcont_handler __ARGS(SIGPROTOARG);
309 sigcont_received = FALSE;
311 kill(0, SIGTSTP); /* send ourselves a STOP signal */
313 ! /* When we didn't suspend immediately in the kill(), do it now. Happens
314 ! * on multi-threaded Solaris. */
315 ! if (!sigcont_received)
324 ! # if defined(_REENTRANT) && defined(SIGCONT)
325 sigcont_received = FALSE;
327 kill(0, SIGTSTP); /* send ourselves a STOP signal */
328 ! # if defined(_REENTRANT) && defined(SIGCONT)
330 ! * Wait for the SIGCONT signal to be handled. It generally happens
331 ! * immediately, but somehow not all the time. Do not call pause()
332 ! * because there would be race condition which would hang Vim if
333 ! * signal happened in between the test of sigcont_received and the
334 ! * call to pause(). If signal is not yet received, call sleep(0)
335 ! * to just yield CPU. Signal should then be received. If somehow
336 ! * it's still not received, sleep 1, 2, 3 ms. Don't bother waiting
337 ! * further if signal is not received after 1+2+3+4 ms (not expected
342 ! for (wait = 0; !sigcont_received && wait <= 3L; wait++)
343 ! /* Loop is not entered most of the time */
344 ! mch_delay(wait, FALSE);
352 signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL);
355 signal(SIGCONT, sigcont_handler);
360 signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL);
362 ! #if defined(_REENTRANT) && defined(SIGCONT)
363 signal(SIGCONT, sigcont_handler);
370 catch_signals(SIG_DFL, SIG_DFL);
372 /* SIGCONT isn't in the list, because its default action is ignore */
373 signal(SIGCONT, SIG_DFL);
378 catch_signals(SIG_DFL, SIG_DFL);
379 ! #if defined(_REENTRANT) && defined(SIGCONT)
380 /* SIGCONT isn't in the list, because its default action is ignore */
381 signal(SIGCONT, SIG_DFL);
386 * we are going to suspend or starting an external process
387 * so we shouldn't have problem with this
390 signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL);
392 return 1; /* succeed */
395 *** ../vim-7.2.129/src/version.c Mon Mar 2 02:11:09 2009
396 --- src/version.c Mon Mar 2 02:36:00 2009
400 { /* Add new patch number below this line */
406 hundred-and-one symptoms of being an internet addict:
407 148. You find it easier to dial-up the National Weather Service
408 Weather/your_town/now.html than to simply look out the window.
410 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
411 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
412 \\\ download, build and distribute -- http://www.A-A-P.org ///
413 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///