8200256: java/nio/channels/AsynchronousChannelGroup/Basic.java fails intermittently

Reviewed-by: chegar
This commit is contained in:
Alan Bateman 2018-03-27 19:29:46 +01:00
parent debaf13f38
commit 704b2ccd93
8 changed files with 57 additions and 17 deletions

View file

@ -104,7 +104,6 @@ Java_sun_nio_ch_IOUtil_makePipe(JNIEnv *env, jobject this, jboolean blocking)
return ((jlong) fd[0] << 32) | (jlong) fd[1];
}
JNIEXPORT jint JNICALL
Java_sun_nio_ch_IOUtil_write1(JNIEnv *env, jclass cl, jint fd, jbyte b)
{
@ -112,7 +111,6 @@ Java_sun_nio_ch_IOUtil_write1(JNIEnv *env, jclass cl, jint fd, jbyte b)
return convertReturnVal(env, write(fd, &c, 1), JNI_FALSE);
}
JNIEXPORT jboolean JNICALL
Java_sun_nio_ch_IOUtil_drain(JNIEnv *env, jclass cl, jint fd)
{
@ -130,6 +128,26 @@ Java_sun_nio_ch_IOUtil_drain(JNIEnv *env, jclass cl, jint fd)
}
}
JNIEXPORT jint JNICALL
Java_sun_nio_ch_IOUtil_drain1(JNIEnv *env, jclass cl, jint fd)
{
int res;
char buf[1];
res = read(fd, buf, 1);
if (res < 0) {
if (errno == EAGAIN) {
res = 0;
} else if (errno == EINTR) {
return IOS_INTERRUPTED;
} else {
JNU_ThrowIOExceptionWithLastError(env, "read");
return IOS_THROWN;
}
}
return res;
}
JNIEXPORT jint JNICALL
Java_sun_nio_ch_IOUtil_fdLimit(JNIEnv *env, jclass this)
{