an optional name for the thread
the function to be called by the thread
Creates a new thread that will execute the specified function in parallel.
the function to be called by the thread
A convenient reference to the ReentrantLock class that can be used for synchronization purposes.
Returns whether the thread is still alive.
true if the thread has been started but has not finished
Returns true if this thread has finished and did not end by throwing an uncaught exception.
whether this thread's function returned normally
Returns the name of the thread, if any. IF the thread was not assigned a name at construction, it is given a default name.
the thread name
Returns the value returned by the function passed to the thread's constructor. A function that returns no value implicitly returns undefined. If the function has not yet finished, this method returns null. If the function threw an uncaught exception, then calling this method will immediately throw that exception.
When called from any thread, returns true if that thread's interrupted flag has been set, then clears the flag.
Sets the thread's interrupted flag.
Cause the thread that this method is called from to wait until the thread represented by the Thread instance finishes running. If a timeout is specified, it will wait up to that long; otherwise it will wait forever.
the maximum time, in milliseconds, to wait for the thread
the value that was returned by the function passed to the constructor (if the thread ended before the timeout elapsed)
Starts executing the thread in parallel. A new operating system thread is created, and then the supplied function will be called from that thread.
Note that a thread can only be started once. To run the same function multiple times in parallel, you must create a new thread for each run.
Runs a lengthy task in the background while providing feedback to the
user on the progress of the task. When called, this function blocks
the user interface with a status window as long as the task
executes.
The window displays title and status text that can be updated to reflect
the state of the task, as well as a progress bar, and optionally a
Cancel button. The task function is passed a single object whose
properties can be updated to change the status displayed by the busy window.
the function to run during which the app is "busy"
a title for the window
if true, a cancel button is shown whose status can be read from the task function
Calls the given function on the event dispatch (user interface) thread, waiting for it to return. If the current thread is the event dispatch thread, then it will run immediately. Otherwise, the current thread will be paused until the event dispatch thread is able to execute the function. Note that if you create a situation where the interface thread is waiting for this thread, and this thread is waiting for the interface thread, the app will deadlock.
the result returned by the function, if any
Calls the given function on the event dispatch (user interface) thread at some point in the future, without waiting for it to return. For example:
Thread.invokeLater(
function() {
println("I will be called later.");
}
);
println("I will be called now.");
the function to invoke in the future from the interface thread
This is a convenience function that creates a new thread for the specified function and immediately starts it.
the function to call from another thread
the new, already-started Thread instance
Creates a new thread that will execute the specified function in parallel.