mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 19:44:41 +02:00
8229018: Switching to an infinite socket timeout on Windows leads to high CPU load
Reviewed-by: michaelm
This commit is contained in:
parent
2f16ca0f59
commit
d5ceec68b4
1 changed files with 6 additions and 4 deletions
|
@ -623,9 +623,6 @@ Java_sun_nio_ch_Net_poll(JNIEnv* env, jclass this, jobject fdo, jint events, jlo
|
||||||
fd_set rd, wr, ex;
|
fd_set rd, wr, ex;
|
||||||
jint fd = fdval(env, fdo);
|
jint fd = fdval(env, fdo);
|
||||||
|
|
||||||
t.tv_sec = (long)(timeout / 1000);
|
|
||||||
t.tv_usec = (timeout % 1000) * 1000;
|
|
||||||
|
|
||||||
FD_ZERO(&rd);
|
FD_ZERO(&rd);
|
||||||
FD_ZERO(&wr);
|
FD_ZERO(&wr);
|
||||||
FD_ZERO(&ex);
|
FD_ZERO(&ex);
|
||||||
|
@ -638,7 +635,12 @@ Java_sun_nio_ch_Net_poll(JNIEnv* env, jclass this, jobject fdo, jint events, jlo
|
||||||
}
|
}
|
||||||
FD_SET(fd, &ex);
|
FD_SET(fd, &ex);
|
||||||
|
|
||||||
rv = select(fd+1, &rd, &wr, &ex, &t);
|
if (timeout >= 0) {
|
||||||
|
t.tv_sec = (long)(timeout / 1000);
|
||||||
|
t.tv_usec = (timeout % 1000) * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
rv = select(fd+1, &rd, &wr, &ex, (timeout >= 0) ? &t : NULL);
|
||||||
|
|
||||||
/* save last winsock error */
|
/* save last winsock error */
|
||||||
if (rv == SOCKET_ERROR) {
|
if (rv == SOCKET_ERROR) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue