8053931: (fc) FileDispatcherImpl.lock0 does not handle ERROR_IO_PENDING [win]
Reviewed-by: alanb
Contributed-by: martin.doerr@sap.com
--- a/jdk/src/windows/native/sun/nio/ch/FileDispatcherImpl.c Fri Aug 01 15:36:23 2014 +0100
+++ b/jdk/src/windows/native/sun/nio/ch/FileDispatcherImpl.c Fri Aug 01 15:50:01 2014 +0100
@@ -406,6 +406,14 @@
result = LockFileEx(h, flags, 0, lowNumBytes, highNumBytes, &o);
if (result == 0) {
int error = GetLastError();
+ if (error == ERROR_IO_PENDING) {
+ LPDWORD dwBytes;
+ result = GetOverlappedResult(h, &o, &dwBytes, TRUE);
+ if (result != 0) {
+ return sun_nio_ch_FileDispatcherImpl_LOCKED;
+ }
+ error = GetLastError();
+ }
if (error != ERROR_LOCK_VIOLATION) {
JNU_ThrowIOExceptionWithLastError(env, "Lock failed");
return sun_nio_ch_FileDispatcherImpl_NO_LOCK;