mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +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, 2019, 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
|
||||
|
@ -26,44 +26,19 @@
|
|||
package java.lang;
|
||||
|
||||
/**
|
||||
* The {@code Runnable} interface should be implemented by any
|
||||
* class whose instances are intended to be executed by a thread. The
|
||||
* class must define a method of no arguments called {@code run}.
|
||||
* <p>
|
||||
* This interface is designed to provide a common protocol for objects that
|
||||
* wish to execute code while they are active. For example,
|
||||
* {@code Runnable} is implemented by class {@code Thread}.
|
||||
* Being active simply means that a thread has been started and has not
|
||||
* yet been stopped.
|
||||
* <p>
|
||||
* In addition, {@code Runnable} provides the means for a class to be
|
||||
* active while not subclassing {@code Thread}. A class that implements
|
||||
* {@code Runnable} can run without subclassing {@code Thread}
|
||||
* by instantiating a {@code Thread} instance and passing itself in
|
||||
* as the target. In most cases, the {@code Runnable} interface should
|
||||
* be used if you are only planning to override the {@code run()}
|
||||
* method and no other {@code Thread} methods.
|
||||
* This is important because classes should not be subclassed
|
||||
* unless the programmer intends on modifying or enhancing the fundamental
|
||||
* behavior of the class.
|
||||
* Represents an operation that does not return a result.
|
||||
*
|
||||
* <p> This is a {@linkplain java.util.function functional interface}
|
||||
* whose functional method is {@link #run()}.
|
||||
*
|
||||
* @author Arthur van Hoff
|
||||
* @see java.lang.Thread
|
||||
* @see java.util.concurrent.Callable
|
||||
* @since 1.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Runnable {
|
||||
/**
|
||||
* When an object implementing interface {@code Runnable} is used
|
||||
* to create a thread, starting the thread causes the object's
|
||||
* {@code run} method to be called in that separately executing
|
||||
* thread.
|
||||
* <p>
|
||||
* The general contract of the method {@code run} is that it may
|
||||
* take any action whatsoever.
|
||||
*
|
||||
* @see java.lang.Thread#run()
|
||||
* Runs this operation.
|
||||
*/
|
||||
public abstract void run();
|
||||
void run();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue