diff options
| author | YAMAMOTO Mitsuharu | 2007-08-24 08:51:18 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2007-08-24 08:51:18 +0000 |
| commit | 90fa408d58c28158c7a297c734d9a7a2aac12335 (patch) | |
| tree | ac41a3c6dd3e496011c2d86befea40ae82996ff8 /src | |
| parent | a2a32f6f06b44a8c1414e69aa36f564b7a858b04 (diff) | |
| download | emacs-90fa408d58c28158c7a297c734d9a7a2aac12335.tar.gz emacs-90fa408d58c28158c7a297c734d9a7a2aac12335.zip | |
[MAC_OSX] (select_and_poll_event, sys_select): Fix last changes.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/mac.c | 33 |
2 files changed, 30 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 164a6c19d60..ab10c92d286 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2007-08-24 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * mac.c [MAC_OSX] (select_and_poll_event, sys_select): Fix last changes. | ||
| 4 | |||
| 1 | 2007-08-24 Martin Rudalics <rudalics@gmx.at> | 5 | 2007-08-24 Martin Rudalics <rudalics@gmx.at> |
| 2 | 6 | ||
| 3 | * fileio.c (Finsert_file_contents): Consult CHARS_MODIFF to tell | 7 | * fileio.c (Finsert_file_contents): Consult CHARS_MODIFF to tell |
| @@ -4989,8 +4989,8 @@ extern int noninteractive; | |||
| 4989 | SELECT_TIMEOUT_THRESHOLD_RUNLOOP seconds). | 4989 | SELECT_TIMEOUT_THRESHOLD_RUNLOOP seconds). |
| 4990 | -> Create CFSocket for each socket and add it into the current | 4990 | -> Create CFSocket for each socket and add it into the current |
| 4991 | event RunLoop so that the current event loop gets quit when | 4991 | event RunLoop so that the current event loop gets quit when |
| 4992 | the socket becomes ready. Then ReceiveNextEvent can wait for | 4992 | the socket becomes ready. Then CFRunLoopRunInMode can wait |
| 4993 | both kinds of inputs. | 4993 | for both kinds of inputs. |
| 4994 | 4. Otherwise. | 4994 | 4. Otherwise. |
| 4995 | -> Periodically poll the window input channel while repeatedly | 4995 | -> Periodically poll the window input channel while repeatedly |
| 4996 | executing `select' with a short timeout | 4996 | executing `select' with a short timeout |
| @@ -5029,32 +5029,51 @@ select_and_poll_event (nfds, rfds, wfds, efds, timeout) | |||
| 5029 | ? (EMACS_SECS (*timeout) * kEventDurationSecond | 5029 | ? (EMACS_SECS (*timeout) * kEventDurationSecond |
| 5030 | + EMACS_USECS (*timeout) * kEventDurationMicrosecond) | 5030 | + EMACS_USECS (*timeout) * kEventDurationMicrosecond) |
| 5031 | : kEventDurationForever); | 5031 | : kEventDurationForever); |
| 5032 | SELECT_TYPE orfds, owfds, oefds; | ||
| 5033 | |||
| 5034 | if (timeout == NULL) | ||
| 5035 | { | ||
| 5036 | if (rfds) orfds = *rfds; | ||
| 5037 | if (wfds) owfds = *wfds; | ||
| 5038 | if (efds) oefds = *efds; | ||
| 5039 | } | ||
| 5032 | 5040 | ||
| 5033 | /* Try detect_input_pending before CFRunLoopRunInMode in the same | 5041 | /* Try detect_input_pending before CFRunLoopRunInMode in the same |
| 5034 | BLOCK_INPUT block, in case that some input has already been read | 5042 | BLOCK_INPUT block, in case that some input has already been read |
| 5035 | asynchronously. */ | 5043 | asynchronously. */ |
| 5036 | BLOCK_INPUT; | 5044 | BLOCK_INPUT; |
| 5037 | do | 5045 | while (1) |
| 5038 | { | 5046 | { |
| 5039 | if (detect_input_pending ()) | 5047 | if (detect_input_pending ()) |
| 5040 | break; | 5048 | break; |
| 5041 | 5049 | ||
| 5042 | EMACS_SET_SECS_USECS (select_timeout, 0, 0); | 5050 | EMACS_SET_SECS_USECS (select_timeout, 0, 0); |
| 5043 | r = select (nfds, rfds, wfds, efds, &select_timeout); | 5051 | r = select (nfds, rfds, wfds, efds, &select_timeout); |
| 5052 | if (r != 0) | ||
| 5053 | break; | ||
| 5054 | |||
| 5044 | if (timeoutval == 0.0) | 5055 | if (timeoutval == 0.0) |
| 5045 | timedout_p = 1; | 5056 | timedout_p = 1; |
| 5046 | else if (r == 0) | 5057 | else |
| 5047 | { | 5058 | { |
| 5048 | #if USE_CG_DRAWING | 5059 | #if USE_CG_DRAWING |
| 5049 | mac_prepare_for_quickdraw (NULL); | 5060 | mac_prepare_for_quickdraw (NULL); |
| 5050 | #endif | 5061 | #endif |
| 5051 | if (CFRunLoopRunInMode (kCFRunLoopDefaultMode, | 5062 | if (CFRunLoopRunInMode (kCFRunLoopDefaultMode, |
| 5052 | timeoutval >= 0 ? timeoutval : 10000.0, true) | 5063 | timeoutval >= 0 ? timeoutval : 100000, true) |
| 5053 | == kCFRunLoopRunTimedOut) | 5064 | == kCFRunLoopRunTimedOut) |
| 5054 | timedout_p = 1; | 5065 | timedout_p = 1; |
| 5055 | } | 5066 | } |
| 5067 | |||
| 5068 | if (timeout == NULL && timedout_p) | ||
| 5069 | { | ||
| 5070 | if (rfds) *rfds = orfds; | ||
| 5071 | if (wfds) *wfds = owfds; | ||
| 5072 | if (efds) *efds = oefds; | ||
| 5073 | } | ||
| 5074 | else | ||
| 5075 | break; | ||
| 5056 | } | 5076 | } |
| 5057 | while (timeoutval < 0 && timedout_p); | ||
| 5058 | UNBLOCK_INPUT; | 5077 | UNBLOCK_INPUT; |
| 5059 | 5078 | ||
| 5060 | if (r != 0) | 5079 | if (r != 0) |
| @@ -5181,7 +5200,7 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 5181 | mac_prepare_for_quickdraw (NULL); | 5200 | mac_prepare_for_quickdraw (NULL); |
| 5182 | #endif | 5201 | #endif |
| 5183 | if (CFRunLoopRunInMode (kCFRunLoopDefaultMode, | 5202 | if (CFRunLoopRunInMode (kCFRunLoopDefaultMode, |
| 5184 | timeoutval >= 0 ? timeoutval : 10000.0, true) | 5203 | timeoutval >= 0 ? timeoutval : 100000, true) |
| 5185 | == kCFRunLoopRunTimedOut) | 5204 | == kCFRunLoopRunTimedOut) |
| 5186 | timedout_p = 1; | 5205 | timedout_p = 1; |
| 5187 | 5206 | ||