threads

Basic multithreading support.
Thread( functionToRun ) constructor
Thread.start()
Thread.alive read-only
Thread.interrupt()
Thread.interrupted static
Thread.join( [msTimeout] )
Thread.hasReturnValue read-only
Thread.returnValue read-only
Thread.busyWindow( task, [message] ) static
Thread.run( functionToRun ) static
Thread.invokeLater( functionToRun ) static
Thread.invokeAndWait( functionToRun ) static
Thread.Lock : java.util.concurrent.locks.ReentrantLock constructor static

Basic multithreading support.

Thread( functionToRun ) constructor

Create a new thread that will execute functionToRun.

Note: Any calls into Strange Eons from the background thread must be made on the event dispatch thread. (Use Thread.invokeLater() or Thread.invokeAndWait().)

Thread.start()

Starts executing functionToRun in parallel with the caller.

Thread.alive read-only

This is true if the thread has been started but has not yet finished.

true if the thread is running

Thread.interrupt()

Sets the thread's interruption flag. interrupted. Checking this value clears it to false until the next time the thread is interrupted.

Thread.interrupted static

This is true if the currently running thread has been interrupted. Checking this value clears it to false until the next time the thread is interrupted.

Thread.join( [msTimeout] )

Causes the current thread to wait until this thread ends. If the optional msTimeout is given, the current thread will stop waiting after that many milliseconds.

msTimeout the maximum time to wait, in ms (default is to wait forever)

returns the value returned by the Thread's functionToRun, if the function returns a value and the thread ended before the timeout elapsed

Thread.hasReturnValue read-only

This is true if this thread has completed normally. If the thread has not been started, is still alive, or ends with an exception, then it returns false. Not that this property does not indicate whether the function actually returned anything, only that if it did, it is now available to be read.

Thread.returnValue read-only

If the thread has been started and the thread's functionToRun has finished executing without throwing an uncaught exception, then this property will store the value returned by the function, if any.

Thread.busyWindow( task, [message] ) static

Runs a lengthy task in the background while providing feedback to the user.

task a function to be run in the background
message a description of the task being performed

Thread.run( functionToRun ) static

Starts a new thread. This is a convenience that creates a new Thread and immediately start()s it. The new Thread is returned.

returns the new Thread

Thread.invokeLater( functionToRun ) static

Run a task on the event dispatch thread without waiting for it to return. For example:
 Thread.invokeLater(
     function() {
         println( "I will be called later." );
     }
 );
 println( "I will be called now." );

Thread.invokeAndWait( functionToRun ) static

Run a task on the event dispatch 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.

Returns the result returned by functionToRun, or undefined if the task throws an exception

Thread.Lock : java.util.concurrent.locks.ReentrantLock constructor static

This is a convenient reference to the class java.util.concurrent.locks.ReentrantLock that can be used for synchronization purposes.

Index    Contents