PatchSet 5150 
Date: 2004/09/10 00:34:21
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Fixed jthreadedRecvfrom  timeout handling

2004-09-09  Noa Resare  <[EMAIL PROTECTED]>

        * kaffe/kaffevm/systems/unix-pthreads/syscalls.c:
        (jthreadedRecvfrom) fixed timeout handling

Members: 
        ChangeLog:1.2706->1.2707 
        kaffe/kaffevm/systems/unix-pthreads/syscalls.c:1.19->1.20 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2706 kaffe/ChangeLog:1.2707
--- kaffe/ChangeLog:1.2706      Thu Sep  9 20:33:17 2004
+++ kaffe/ChangeLog     Fri Sep 10 00:34:21 2004
@@ -1,3 +1,8 @@
+2004-09-09  Noa Resare  <[EMAIL PROTECTED]>
+
+       * kaffe/kaffevm/systems/unix-pthreads/syscalls.c:
+       (jthreadedRecvfrom) fixed timeout handling
+
 2004-09-09  Dalibor Topic  <[EMAIL PROTECTED]>
 
        * libraries/javalib/rebuildLib.in: Increased memory available 
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/syscalls.c
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/syscalls.c:1.19 
kaffe/kaffe/kaffevm/systems/unix-pthreads/syscalls.c:1.20
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/syscalls.c:1.19   Thu Aug 19 09:51:00 
2004
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/syscalls.c        Fri Sep 10 00:34:24 
2004
@@ -19,6 +19,9 @@
 #include "jsyscall.h"
 #include "jsignal.h"
 #include "nets.h"
+#if defined(HAVE_SYS_POLL_H)
+#include <sys/poll.h>
+#endif
 #if defined(HAVE_SYS_WAIT_H)
 #include <sys/wait.h>
 #endif
@@ -34,7 +37,7 @@
 #define BREAK_IF_LATE(deadline, timeout)               \
        if (timeout != NOTIMEOUT) {                     \
                if (currentTime() >= deadline) {        \
-                       errno = EINTR;                  \
+                       errno = ETIMEDOUT;              \
                        break;                          \
                }                                       \
        }
@@ -614,7 +617,13 @@
 {
        int r;
        jlong deadline = 0;
+       int fd_flags;
+       int poll_timeout;
+
+       struct pollfd sp = {fd, POLLIN|POLLPRI, 0};
  
+       fd_flags = fcntl(fd, F_GETFL);
+       fcntl(fd, F_SETFL, fd_flags|O_NONBLOCK);
        SET_DEADLINE(deadline, timeout)
        for (;;) {
                r = recvfrom(fd, buf, len, flags, from, fromlen);
@@ -623,8 +632,13 @@
                        break;
                }
                IGNORE_EINTR(r)
+               poll_timeout = deadline - currentTime();
+               if (poll_timeout > 0) {
+                       poll(&sp, 1, poll_timeout);
+               }
                BREAK_IF_LATE(deadline, timeout)
        }
+       fcntl(fd, F_SETFL, fd_flags);
        SET_RETURN_OUT(r, out, r)
        return (r);
 }

_______________________________________________
kaffe mailing list
[EMAIL PROTECTED]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe

Reply via email to