PERFORCE change 164496 for review
Zhao Shuai
zhaoshuai at FreeBSD.org
Tue Jun 16 12:45:22 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=164496
Change 164496 by zhaoshuai at zhaoshuai on 2009/06/16 12:44:34
select/poll() hang up is the right behavior.
Affected files ...
.. //depot/projects/soc2009/fifo/fifo_test/functionality/poll.c#3 edit
.. //depot/projects/soc2009/fifo/fifo_test/functionality/select.c#6 edit
Differences ...
==== //depot/projects/soc2009/fifo/fifo_test/functionality/poll.c#3 (text+ko) ====
@@ -1,7 +1,7 @@
/*
* Basic FIFO poll test.
*
- * 1. poll on read descriptor - The same problem as select.
+ * 1. poll on read descriptor - OK.
* 2. poll on write descriptor - OK.
*/
@@ -41,6 +41,11 @@
ret = poll(&pfd, 1, INFTIM);
if (ret > 0) {
printf("poll returned %d, revents = %d\n", ret, (int)pfd.revents);
+
+ if (pfd.revents & POLLHUP) {
+ printf("peer disconnected\n");
+ return (0);
+ }
#if TEST_READ
if (pfd.revents & POLLRDNORM) {
n = read(fd, rbuf, BUF_SIZE);
==== //depot/projects/soc2009/fifo/fifo_test/functionality/select.c#6 (text+ko) ====
@@ -1,10 +1,7 @@
/*
* Basic FIFO select test.
*
- * 1. select on read descriptor - XXX
- * if writer exits before us, "top" shows that we are busy
- * consuming CPU rather than sleep.
- *
+ * 1. select on read descriptor - OK
* 2. select on write descriptor - OK
*/
More information about the p4-projects
mailing list