class Event

A thread safe way of signalling events between threads

Example

global {
    object event;
    number value;
}

class Producer extends Thread {
    function run() {
        while( true ) {            
            value = 10;
            event.signal();
        }
    }
}
class Consumer extends Thread {
    function run() {
        while( true ) {
            event.wait();
            Console.println( "value: $value" );
        }
    }
}

object producer = new Producer();
object consumer = new Consumer();
event = new Event();

producer.start();
consumer.start();

class contents [NB. Highlighted attributes are static members]
Functions
function signal() - Cause an event to be broadcasted
function timedWait(number) - This thread will wait for a signal to be called
function wait() - This thread will wait for a signal to be called

Functions

function signal Click to go up to the list
Cause an event to be broadcasted
Declaration:
    function signal()
Description:
Signals any threads in wait or timedwait that it is okay to continue

function timedWait Click to go up to the list
This thread will wait for a signal to be called
Declaration:
    function timedWait( number seconds)
Parameters:
    Parameter #1: number seconds - The amount of time to wait in seconds
Returns:
    true if a signal was caught, false otherwise

function wait Click to go up to the list
This thread will wait for a signal to be called
Declaration:
    function wait()

Automatically generated at 12:08PM, Wednesday 25 May 2005 by feritedoc.