Author: jonpryor
Date: 2008-02-08 12:05:34 -0500 (Fri, 08 Feb 2008)
New Revision: 95276
Modified:
trunk/mono/support/ChangeLog
trunk/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: trunk/mono/support/ChangeLog
===================================================================
--- trunk/mono/support/ChangeLog 2008-02-08 16:45:08 UTC (rev 95275)
+++ trunk/mono/support/ChangeLog 2008-02-08 17:05:34 UTC (rev 95276)
@@ -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: trunk/mono/support/signal.c
===================================================================
--- trunk/mono/support/signal.c 2008-02-08 16:45:08 UTC (rev 95275)
+++ trunk/mono/support/signal.c 2008-02-08 17:05:34 UTC (rev 95276)
@@ -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