提交 58c62d87 编写于 作者: A acorn

6763959: java.util.concurrent.locks.LockSupport.parkUntil(0) blocks forever

Summary: Absolute time 0 needs to return immediately.
Reviewed-by: phh, dcubed, dholmes
上级 bbca32f6
/* /*
* Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -4839,7 +4839,7 @@ void Parker::park(bool isAbsolute, jlong time) { ...@@ -4839,7 +4839,7 @@ void Parker::park(bool isAbsolute, jlong time) {
// Next, demultiplex/decode time arguments // Next, demultiplex/decode time arguments
timespec absTime; timespec absTime;
if (time < 0) { // don't wait at all if (time < 0 || (isAbsolute && time == 0) ) { // don't wait at all
return; return;
} }
if (time > 0) { if (time > 0) {
......
/* /*
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -5837,7 +5837,7 @@ void Parker::park(bool isAbsolute, jlong time) { ...@@ -5837,7 +5837,7 @@ void Parker::park(bool isAbsolute, jlong time) {
// First, demultiplex/decode time arguments // First, demultiplex/decode time arguments
timespec absTime; timespec absTime;
if (time < 0) { // don't wait at all if (time < 0 || (isAbsolute && time == 0) ) { // don't wait at all
return; return;
} }
if (time > 0) { if (time > 0) {
......
...@@ -3992,7 +3992,7 @@ void Parker::park(bool isAbsolute, jlong time) { ...@@ -3992,7 +3992,7 @@ void Parker::park(bool isAbsolute, jlong time) {
if (time < 0) { // don't wait if (time < 0) { // don't wait
return; return;
} }
else if (time == 0) { else if (time == 0 && !isAbsolute) {
time = INFINITE; time = INFINITE;
} }
else if (isAbsolute) { else if (isAbsolute) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册