class Thread

A thread object allowing for multi-threaded scripts within the ferite environment

Description

This class provides the basic framework for threading. To create a thread you have to inherit from this base class and create a run method. Once that is done You create an instance of the object and call the .start() method NOT the .run() method. This causes a thread to be spawned and the .run() method called. The thread will exit when the .run() method has completed. If you implement your own constructor is is VITAL that you call super.Thread() to make sure that the native side of the thread is instantiated correctly.

class attributes [NB. Highlighted attributes are static members]
function Thread() - The constructor
function start() - Start the thread of execution
function run() - The function that gets run. The stock run method exits immediatly
function sleep() - Causes the thread to sleep for an amount of time
function join() - Cause the calling thread to wait for the thread passed to the method to complete
function setPassExceptions() - Set whether or not exceptions within a thread are passed onto the main process when the thread finishes executing
function isRunning() - Check to see if the thread is running

Functions

function Thread Click to go up to the list
The constructor
Declaration:
    native function Thread()

function start Click to go up to the list
Start the thread of execution
Declaration:
    native function start( number detach )
Description:
When this function is run, it will return straight away. Pass true if you want the Thread to automatically clear itself up. Otherwise Thread.join() must be called on it.
Parameters:
    Parameter #1: number detach - 'true' or 'false', if 'true' the thread will detach upon running

function run Click to go up to the list
The function that gets run. The stock run method exits immediatly
Declaration:
    function run()

function sleep Click to go up to the list
Causes the thread to sleep for an amount of time
Declaration:
    native function sleep( number msecs )
Parameters:
    Parameter #1: number msecs - The amount of time to sleep in microseconds

static function join Click to go up to the list
Cause the calling thread to wait for the thread passed to the method to complete
Declaration:
    static native function join( object thread )
Parameters:
    Parameter #1: object thread - The thread to wait for

function setPassExceptions Click to go up to the list
Set whether or not exceptions within a thread are passed onto the main process when the thread finishes executing
Declaration:
    native function setPassExceptions( number value )
Parameters:
    Parameter #1: number value - Either true or false

function isRunning Click to go up to the list
Check to see if the thread is running
Declaration:
    native function isRunning()
Returns:
    true if it is running, false otherwise

Automatically generated at 8:45pm, Wednesday 08 January 2003 by feritedoc.