OpenJDK / jdk / jdk10
changeset 25806:7a0cf527248e
8053931: (fc) FileDispatcherImpl.lock0 does not handle ERROR_IO_PENDING [win]
Reviewed-by: alanb
Contributed-by: martin.doerr@sap.com
author | alanb |
---|---|
date | Fri, 01 Aug 2014 15:50:01 +0100 |
parents | 0bc2aa4aadbe |
children | 6c325960c9ee |
files | jdk/src/windows/native/sun/nio/ch/FileDispatcherImpl.c |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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;