diff options
| author | Stefan Monnier | 2004-01-21 05:15:12 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2004-01-21 05:15:12 +0000 |
| commit | b65c1b44897ddae92eca834f60f11008aee94247 (patch) | |
| tree | 4fae333456330686707c2076fd477b00d195d96d /src | |
| parent | d7107586380ccd8825ec6ce8dcc289bb6885bd64 (diff) | |
| download | emacs-b65c1b44897ddae92eca834f60f11008aee94247.tar.gz emacs-b65c1b44897ddae92eca834f60f11008aee94247.zip | |
(handle_async_input): New fun, extracted from input_available_signal.
(input_available_signal, reinvoke_input_signal): Use it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index f843edf6438..d6a743489a1 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Keyboard and mouse input; editor command loop. | 1 | /* Keyboard and mouse input; editor command loop. |
| 2 | Copyright (C) 1985,86,87,88,89,93,94,95,96,97,99,2000,01,02,03 | 2 | Copyright (C) 1985,86,87,88,89,93,94,95,96,97,99,2000,01,02,03,04 |
| 3 | Free Software Foundation, Inc. | 3 | Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| @@ -6747,6 +6747,30 @@ read_avail_input (expected) | |||
| 6747 | } | 6747 | } |
| 6748 | #endif /* not VMS */ | 6748 | #endif /* not VMS */ |
| 6749 | 6749 | ||
| 6750 | void | ||
| 6751 | handle_async_input () | ||
| 6752 | { | ||
| 6753 | #ifdef BSD4_1 | ||
| 6754 | extern int select_alarmed; | ||
| 6755 | #endif | ||
| 6756 | interrupt_input_pending = 0; | ||
| 6757 | |||
| 6758 | while (1) | ||
| 6759 | { | ||
| 6760 | int nread; | ||
| 6761 | nread = read_avail_input (1); | ||
| 6762 | /* -1 means it's not ok to read the input now. | ||
| 6763 | UNBLOCK_INPUT will read it later; now, avoid infinite loop. | ||
| 6764 | 0 means there was no keyboard input available. */ | ||
| 6765 | if (nread <= 0) | ||
| 6766 | break; | ||
| 6767 | |||
| 6768 | #ifdef BSD4_1 | ||
| 6769 | select_alarmed = 1; /* Force the select emulator back to life */ | ||
| 6770 | #endif | ||
| 6771 | } | ||
| 6772 | } | ||
| 6773 | |||
| 6750 | #ifdef SIGIO /* for entire page */ | 6774 | #ifdef SIGIO /* for entire page */ |
| 6751 | /* Note SIGIO has been undef'd if FIONREAD is missing. */ | 6775 | /* Note SIGIO has been undef'd if FIONREAD is missing. */ |
| 6752 | 6776 | ||
| @@ -6756,9 +6780,6 @@ input_available_signal (signo) | |||
| 6756 | { | 6780 | { |
| 6757 | /* Must preserve main program's value of errno. */ | 6781 | /* Must preserve main program's value of errno. */ |
| 6758 | int old_errno = errno; | 6782 | int old_errno = errno; |
| 6759 | #ifdef BSD4_1 | ||
| 6760 | extern int select_alarmed; | ||
| 6761 | #endif | ||
| 6762 | 6783 | ||
| 6763 | #if defined (USG) && !defined (POSIX_SIGNALS) | 6784 | #if defined (USG) && !defined (POSIX_SIGNALS) |
| 6764 | /* USG systems forget handlers when they are used; | 6785 | /* USG systems forget handlers when they are used; |
| @@ -6773,20 +6794,11 @@ input_available_signal (signo) | |||
| 6773 | if (input_available_clear_time) | 6794 | if (input_available_clear_time) |
| 6774 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); | 6795 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); |
| 6775 | 6796 | ||
| 6776 | while (1) | 6797 | #ifdef SYNC_INPUT |
| 6777 | { | 6798 | interrupt_input_pending = 1; |
| 6778 | int nread; | 6799 | #else |
| 6779 | nread = read_avail_input (1); | 6800 | handle_async_input (); |
| 6780 | /* -1 means it's not ok to read the input now. | ||
| 6781 | UNBLOCK_INPUT will read it later; now, avoid infinite loop. | ||
| 6782 | 0 means there was no keyboard input available. */ | ||
| 6783 | if (nread <= 0) | ||
| 6784 | break; | ||
| 6785 | |||
| 6786 | #ifdef BSD4_1 | ||
| 6787 | select_alarmed = 1; /* Force the select emulator back to life */ | ||
| 6788 | #endif | 6801 | #endif |
| 6789 | } | ||
| 6790 | 6802 | ||
| 6791 | #ifdef BSD4_1 | 6803 | #ifdef BSD4_1 |
| 6792 | sigfree (); | 6804 | sigfree (); |
| @@ -6805,7 +6817,7 @@ void | |||
| 6805 | reinvoke_input_signal () | 6817 | reinvoke_input_signal () |
| 6806 | { | 6818 | { |
| 6807 | #ifdef SIGIO | 6819 | #ifdef SIGIO |
| 6808 | kill (getpid (), SIGIO); | 6820 | handle_async_input (); |
| 6809 | #endif | 6821 | #endif |
| 6810 | } | 6822 | } |
| 6811 | 6823 | ||