[kaffe] CVS kaffe (guilhem): Fix for jthreadedRecvFrom (use select instead of poll)

Kaffe CVS cvs-commits at kaffe.org
Fri Sep 17 01:35:58 PDT 2004


PatchSet 5177 
Date: 2004/09/17 08:31:56
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Fix for jthreadedRecvFrom (use select instead of poll)

2004-09-17  Noa Resare  <noa at resare.com>
        Guilhem Lavaux  <guilhem at kaffe.org>

        * kaffe/kaffevm/systems/unix-pthreads/syscalls.c:
        (jthreadedRecvfrom) use select() instead of poll()

Members: 
	ChangeLog:1.2732->1.2733 
	kaffe/kaffevm/systems/unix-pthreads/syscalls.c:1.20->1.21 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2732 kaffe/ChangeLog:1.2733
--- kaffe/ChangeLog:1.2732	Thu Sep 16 23:19:23 2004
+++ kaffe/ChangeLog	Fri Sep 17 08:31:56 2004
@@ -1,3 +1,9 @@
+2004-09-17  Noa Resare  <noa at resare.com>
+	Guilhem Lavaux  <guilhem at kaffe.org>
+
+	* kaffe/kaffevm/systems/unix-pthreads/syscalls.c:
+	(jthreadedRecvfrom) use select() instead of poll()
+
 2004-09-16  Noa Resare  <noa at resare.com>
 
 	* kaffe/kaffevm/kaffe-gc/gc-mem.c (gc_block_alloc):
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/syscalls.c
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/syscalls.c:1.20 kaffe/kaffe/kaffevm/systems/unix-pthreads/syscalls.c:1.21
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/syscalls.c:1.20	Fri Sep 10 00:34:24 2004
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/syscalls.c	Fri Sep 17 08:31:59 2004
@@ -19,9 +19,7 @@
 #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
@@ -617,13 +615,9 @@
 {
 	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);
+	jthread_set_blocking(fd, 0);
 	SET_DEADLINE(deadline, timeout)
 	for (;;) {
 		r = recvfrom(fd, buf, len, flags, from, fromlen);
@@ -634,11 +628,11 @@
 		IGNORE_EINTR(r)
 		poll_timeout = deadline - currentTime();
 		if (poll_timeout > 0) {
-			poll(&sp, 1, poll_timeout);
+			waitForTimeout(fd, poll_timeout);
 		}
 		BREAK_IF_LATE(deadline, timeout)
 	}
-	fcntl(fd, F_SETFL, fd_flags);
+	jthread_set_blocking(fd, 1);
 	SET_RETURN_OUT(r, out, r)
 	return (r);
 }




More information about the kaffe mailing list