Author: jonpryor
Date: 2008-02-08 12:09:26 -0500 (Fri, 08 Feb 2008)
New Revision: 95279

Modified:
   branches/mono-1-9/mono/support/ChangeLog
   branches/mono-1-9/mono/support/signal.c
Log:
        * signal.c: Mono_Unix_UnixSignal_WaitAny() semantic change: return the 
index
          into the signals array of the first signaled signal if successful,
          otherwise return the timeout.


Modified: branches/mono-1-9/mono/support/ChangeLog
===================================================================
--- branches/mono-1-9/mono/support/ChangeLog    2008-02-08 17:07:49 UTC (rev 
95278)
+++ branches/mono-1-9/mono/support/ChangeLog    2008-02-08 17:09:26 UTC (rev 
95279)
@@ -1,3 +1,9 @@
+2008-02-08  Jonathan Pryor  <[EMAIL PROTECTED]>
+
+       * signal.c: Mono_Unix_UnixSignal_WaitAny() semantic change: return the 
index
+         into the signals array of the first signaled signal if successful,
+         otherwise return the timeout.
+
 2008-02-07  Jonathan Pryor  <[EMAIL PROTECTED]>
 
        * signal.c: Make the signal handler thread-safe, so that it can safely 
be

Modified: branches/mono-1-9/mono/support/signal.c
===================================================================
--- branches/mono-1-9/mono/support/signal.c     2008-02-08 17:07:49 UTC (rev 
95278)
+++ branches/mono-1-9/mono/support/signal.c     2008-02-08 17:09:26 UTC (rev 
95279)
@@ -221,7 +221,7 @@
 static int
 wait_for_any (signal_info** signals, int count, int max_fd, fd_set* read_fds, 
int timeout)
 {
-       int r;
+       int r, idx;
        do {
                struct timeval tv;
                struct timeval *ptv = NULL;
@@ -234,24 +234,29 @@
                r = select (max_fd + 1, read_fds, NULL, NULL, ptv);
        } while (r == -1 && errno == EINTR);
 
-       if (r > 0) {
+       idx = -1;
+       if (r == 0)
+               idx = timeout;
+       else if (r > 0) {
                int i;
                for (i = 0; i < count; ++i) {
                        signal_info* h = signals [i];
                        if (FD_ISSET (h->read_fd, read_fds)) {
                                char c;
-                               read (h->read_fd, &c, 1); /* ignore error */
+                               read (h->read_fd, &c, 1); /* ignore any error */
+                               if (idx == -1)
+                                       idx = i;
                        }
                }
        }
 
-       return r;
+       return idx;
 }
 
 /*
  * returns: -1 on error:
- *           0 on timeout
- *         > 0 on success
+ *          timeout on timeout
+ *          index into _signals array of signal that was generated on success
  */
 int
 Mono_Unix_UnixSignal_WaitAny (void** _signals, int count, int timeout /* 
milliseconds */)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to