summaryrefslogtreecommitdiff
path: root/src/mac.c
diff options
context:
space:
mode:
authorSteven Tamm <steventamm@mac.com>2002-12-10 18:03:49 +0000
committerSteven Tamm <steventamm@mac.com>2002-12-10 18:03:49 +0000
commit88069dff55bb8a074b8130485382ec2c283725f5 (patch)
tree8ee040215346e2b7c5747b3604e38438e147ee61 /src/mac.c
parentbdce610dee49649c2038af1aec3b92ee1e19bfd3 (diff)
downloademacs-88069dff55bb8a074b8130485382ec2c283725f5.tar.gz
emacs-88069dff55bb8a074b8130485382ec2c283725f5.tar.bz2
emacs-88069dff55bb8a074b8130485382ec2c283725f5.zip
Modifying sys_read to not check the event queue if timeout=0 and to never
use a timeout larger than the one passed in.
Diffstat (limited to 'src/mac.c')
-rw-r--r--src/mac.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mac.c b/src/mac.c
index bf1915cbacd..e81007c4781 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -2769,7 +2769,9 @@ sys_select (n, rfds, wfds, efds, timeout)
{
if (!inhibit_window_system && rfds && FD_ISSET (0, rfds))
return 1;
- else if (inhibit_window_system || noninteractive)
+ else if (inhibit_window_system || noninteractive ||
+ (timeout && (EMACS_SECS(*timeout)==0) &&
+ (EMACS_USECS(*timeout)==0)))
return select(n, rfds, wfds, efds, timeout);
else
{
@@ -2787,6 +2789,9 @@ sys_select (n, rfds, wfds, efds, timeout)
EMACS_SET_SECS (one_second, 1);
EMACS_SET_USECS (one_second, 0);
+ if (timeout && EMACS_TIME_LT(*timeout, one_second))
+ one_second = *timeout;
+
if ((r = select (n, rfds, wfds, efds, &one_second)) > 0)
return r;