mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8284161: Implementation of Virtual Threads (Preview)
Co-authored-by: Ron Pressler <rpressler@openjdk.org> Co-authored-by: Alan Bateman <alanb@openjdk.org> Co-authored-by: Erik Österlund <eosterlund@openjdk.org> Co-authored-by: Andrew Haley <aph@openjdk.org> Co-authored-by: Rickard Bäckman <rbackman@openjdk.org> Co-authored-by: Markus Grönlund <mgronlun@openjdk.org> Co-authored-by: Leonid Mesnik <lmesnik@openjdk.org> Co-authored-by: Serguei Spitsyn <sspitsyn@openjdk.org> Co-authored-by: Chris Plummer <cjplummer@openjdk.org> Co-authored-by: Coleen Phillimore <coleenp@openjdk.org> Co-authored-by: Robbin Ehn <rehn@openjdk.org> Co-authored-by: Stefan Karlsson <stefank@openjdk.org> Co-authored-by: Thomas Schatzl <tschatzl@openjdk.org> Co-authored-by: Sergey Kuksenko <skuksenko@openjdk.org> Reviewed-by: lancea, eosterlund, rehn, sspitsyn, stefank, tschatzl, dfuchs, lmesnik, dcubed, kevinw, amenkov, dlong, mchung, psandoz, bpb, coleenp, smarks, egahlin, mseledtsov, coffeys, darcy
This commit is contained in:
parent
5212535a27
commit
9583e3657e
1133 changed files with 95935 additions and 8335 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -25,6 +25,7 @@
|
|||
|
||||
package java.lang;
|
||||
|
||||
import jdk.internal.misc.Blocker;
|
||||
import jdk.internal.vm.annotation.IntrinsicCandidate;
|
||||
|
||||
/**
|
||||
|
@ -79,11 +80,11 @@ public class Object {
|
|||
* This integer need not remain consistent from one execution of an
|
||||
* application to another execution of the same application.
|
||||
* <li>If two objects are equal according to the {@link
|
||||
* equals(Object) equals} method, then calling the {@code
|
||||
* #equals(Object) equals} method, then calling the {@code
|
||||
* hashCode} method on each of the two objects must produce the
|
||||
* same integer result.
|
||||
* <li>It is <em>not</em> required that if two objects are unequal
|
||||
* according to the {@link equals(Object) equals} method, then
|
||||
* according to the {@link #equals(Object) equals} method, then
|
||||
* calling the {@code hashCode} method on each of the two objects
|
||||
* must produce distinct integer results. However, the programmer
|
||||
* should be aware that producing distinct integer results for
|
||||
|
@ -148,7 +149,7 @@ public class Object {
|
|||
* relation, each equivalence class only has a single element.
|
||||
*
|
||||
* @apiNote
|
||||
* It is generally necessary to override the {@link hashCode hashCode}
|
||||
* It is generally necessary to override the {@link #hashCode() hashCode}
|
||||
* method whenever this method is overridden, so as to maintain the
|
||||
* general contract for the {@code hashCode} method, which states
|
||||
* that equal objects must have equal hash codes.
|
||||
|
@ -359,7 +360,22 @@ public class Object {
|
|||
* @see #wait()
|
||||
* @see #wait(long, int)
|
||||
*/
|
||||
public final native void wait(long timeoutMillis) throws InterruptedException;
|
||||
public final void wait(long timeoutMillis) throws InterruptedException {
|
||||
long comp = Blocker.begin();
|
||||
try {
|
||||
wait0(timeoutMillis);
|
||||
} catch (InterruptedException e) {
|
||||
Thread thread = Thread.currentThread();
|
||||
if (thread.isVirtual())
|
||||
thread.getAndClearInterrupt();
|
||||
throw e;
|
||||
} finally {
|
||||
Blocker.end(comp);
|
||||
}
|
||||
}
|
||||
|
||||
// final modifier so method not in vtable
|
||||
private final native void wait0(long timeoutMillis) throws InterruptedException;
|
||||
|
||||
/**
|
||||
* Causes the current thread to wait until it is awakened, typically
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue