提交 40c77055 编写于 作者: A alanb

7023403: (ch) sun.nio.ch.SolarisEventPort.startPoll failed with AssertionError

Reviewed-by: forax
上级 28503cbb
...@@ -137,7 +137,7 @@ class UnixAsynchronousSocketChannelImpl ...@@ -137,7 +137,7 @@ class UnixAsynchronousSocketChannelImpl
return port; return port;
} }
// register for events if there are outstanding I/O operations // register events for outstanding I/O operations, caller already owns updateLock
private void updateEvents() { private void updateEvents() {
assert Thread.holdsLock(updateLock); assert Thread.holdsLock(updateLock);
int events = 0; int events = 0;
...@@ -149,6 +149,13 @@ class UnixAsynchronousSocketChannelImpl ...@@ -149,6 +149,13 @@ class UnixAsynchronousSocketChannelImpl
port.startPoll(fdVal, events); port.startPoll(fdVal, events);
} }
// register events for outstanding I/O operations
private void lockAndUpdateEvents() {
synchronized (updateLock) {
updateEvents();
}
}
// invoke to finish read and/or write operations // invoke to finish read and/or write operations
private void finish(boolean mayInvokeDirect, private void finish(boolean mayInvokeDirect,
boolean readable, boolean readable,
...@@ -402,9 +409,8 @@ class UnixAsynchronousSocketChannelImpl ...@@ -402,9 +409,8 @@ class UnixAsynchronousSocketChannelImpl
exc = x; exc = x;
} finally { } finally {
// restart poll in case of concurrent write // restart poll in case of concurrent write
synchronized (updateLock) { if (!(exc instanceof AsynchronousCloseException))
updateEvents(); lockAndUpdateEvents();
}
end(); end();
} }
...@@ -598,9 +604,8 @@ class UnixAsynchronousSocketChannelImpl ...@@ -598,9 +604,8 @@ class UnixAsynchronousSocketChannelImpl
exc = x; exc = x;
} finally { } finally {
// restart poll in case of concurrent write // restart poll in case of concurrent write
synchronized (updateLock) { if (!(exc instanceof AsynchronousCloseException))
updateEvents(); lockAndUpdateEvents();
}
end(); end();
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
*/ */
/* @test /* @test
* @bug 4607272 6842687 6878369 * @bug 4607272 6842687 6878369 6944810 7023403
* @summary Unit test for AsynchronousSocketChannel * @summary Unit test for AsynchronousSocketChannel
* @run main/timeout=600 Basic * @run main/timeout=600 Basic
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册