/[emacs]/emacs/src/mac.c
ViewVC logotype

Diff of /emacs/src/mac.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18 by lh, Sat Nov 22 23:00:59 2003 UTC revision 1.19 by tamm, Mon Jul 19 04:42:42 2004 UTC
# Line 2782  sys_select (n, rfds, wfds, efds, timeout Line 2782  sys_select (n, rfds, wfds, efds, timeout
2782    SELECT_TYPE *efds;    SELECT_TYPE *efds;
2783    struct timeval *timeout;    struct timeval *timeout;
2784  {  {
2785    if (!inhibit_window_system && rfds && FD_ISSET (0, rfds))    if (inhibit_window_system || noninteractive
2786      return 1;        || rfds == NULL || !FD_ISSET (0, rfds))
2787    else if (inhibit_window_system || noninteractive ||      return select(n, rfds, wfds, efds, timeout);    
            (timeout && (EMACS_SECS(*timeout)==0) &&  
             (EMACS_USECS(*timeout)==0)))  
     return select(n, rfds, wfds, efds, timeout);  
2788    else    else
2789      {      {
2790        EMACS_TIME end_time, now;        EMACS_TIME end_time, now;
# Line 2798  sys_select (n, rfds, wfds, efds, timeout Line 2795  sys_select (n, rfds, wfds, efds, timeout
2795    
2796        do        do
2797          {          {
2798              EMACS_TIME select_timeout
2799              SELECT_TYPE orfds = *rfds;
2800            int r;            int r;
2801            EMACS_TIME one_second;            OSErr err;
           SELECT_TYPE orfds;  
2802    
2803            FD_ZERO (&orfds);            EMACS_SET_SECS (select_timeout, 0);
2804            if (rfds)            EMACS_SET_USECS (select_timeout, 100);
2805              
2806              if (timeout && EMACS_TIME_LT (*timeout, select_timeout))
2807                select_timeout = *timeout;
2808              
2809              r = select (n, &orfds, wfds, efds, &select_timeout);
2810              err = ReceiveNextEvent (0, NULL, kEventDurationNoWait, false, NULL);
2811              if (r > 0)
2812                {
2813                  *rfds = orfds;
2814                  if (err == noErr)
2815                    {
2816                      FD_SET (0, rfds);
2817                      r++;
2818                    }
2819                  return r;
2820                }
2821              else if (err == noErr)
2822              {              {
2823                orfds = *rfds;                FD_ZERO (rfds);
2824                  FD_SET (0, rfds);
2825                  return 1;
2826              }              }
2827              
           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, &orfds, wfds, efds, &one_second)) > 0)  
             {  
               *rfds = orfds;  
               return r;  
             }  
   
           mac_check_for_quit_char();  
   
2828            EMACS_GET_TIME (now);            EMACS_GET_TIME (now);
2829            EMACS_SUB_TIME (now, end_time, now);            EMACS_SUB_TIME (now, end_time, now);
2830          }          }

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26