Aztec® Programming Language
Version 1.1 Alpha 2

Copyright © 2010-2017, Aztec Development Group, All Rights Reserved

Download Aztec

Search        Contact Us

There's bad lines being drawn.

Nobody's right... If everybody's wrong.

- Stephen Stills

 

aztec.system.Thread

public class abstract Thread from<Base>

Base

Thread

aztec.system.IThread

public class abstract IThread from<Base>

Base

IThread

The Thread class represents a single thread of execution within the Virtual Machine, which in turn is associated with its own underlying operating system thread. It is an abstract class which must be overridden in order to use properly. There are a variety of methods provided to manually control the execution of a thread and to send and receive messages to/from other threads.

 

The IThread class is an abstract interface class which contains a virtual event handler method for each of the events which the Thread class supports.

Thread Methods

Thread() Constructor for the Thread class
Run() Abstract method to create a new VM thread of execution and execute this Run() method within it
ThreadId() Unique thread Id associated with this thread (assigned by the VM)
Sleep() Puts the underlying VM thread to sleep for a specified period of time (milliseconds)
Suspend() Suspends execution of the underlying VM thread
Resume() Resume execution of the underlying thread
Priority() Returns the current execution priority of the thread
SetPriority() Sets the execution priority for the thread
Script() Returns reference to the one and only Script object
IsRunning() Returns true if the thread is currently running
IsIdle() Returns true if the thread is currently in event mode with no events being processed
IsSuspended() Returns true if the thread is currently suspended
IsShuttingDown() Returns true if the thread is currently shutting down
IsTerminated() Returns true if the thread is currently terminated
EventMode() Puts the thread into perpetual event processing mode
ProcessEvents() Interrupts normal processing and executes queued events before proceeding
SendTextMessage() Sends a text message to this thread
SendBinaryMessage() Sends a binary message to this thread (data embedded in a MemoryStream object)
SendObjectMessage() Sends an object message to this thread (a valid Aztec object reference, including null)
AddExceptionHandler() Registers an event handler for an exception being fired using a method reference
AddExceptionHandler() Registers an event handler for an exception being fired using an IThread reference
AddTextMessageHandler() Registers an event handler for receiving a text message using a method reference
AddTextMessageHandler() Registers an event handler for receiving a text message using an IThread reference
AddBinaryMessageHandler() Registers an event handler for receiving a binary message using a method reference
AddBinaryMessageHandler() Registers an event handler for receiving a binary message using an IThread reference
AddObjectMessageHandler() Registers an event handler for receiving an object message using a method reference
AddObjectMessageHandler() Registers an event handler for receiving an object message using an IThread reference
OnException() Virtual method to handle Exception events - can be overridden
OnTextMessage() Virtual method to handle TextMessage events - can be overridden
OnBinaryMessage() Virtual method to handle BinaryMessage events - can be overridden
OnObjectMessage() Virtual method to handle ObjectMessage events - can be overridden

Thread Constants

Constant Data Item Data Type Value
Thread.LowPriority int 1
Thread.MediumLowPriority int 2
Thread.MediumPriority int 3
Thread.MediumHighPriority int 4
Thread.HighPriority int 5

IThread Methods

OnException() Virtual method to handle Exception events - can be overridden
OnTextMessage() Virtual method to handle TextMessage events - can be overridden
OnBinaryMessage() Virtual method to handle BinaryMessage events - can be overridden
OnObjectMessage() Virtual method to handle ObjectMessage events - can be overridden

Derived Classes

See Also

 


Thread()

public method Thread()

Parameters

None

Return Value

None

Description

Constructor for the Thread class.

 

Thread Class


Run()

public method abstract Run()

Parameters

None

Return Value

None

Description

This abstract method must be overridden by the derived class. When the overridden method is invoked, it causes the Virtual Machine to create a new VM thread (which in turn creates a new underlying OS thread) and it executes the code for the Run() method within that new thread.

 

Once the new VM thread is created, the VM assigns a unique ID to the Thread object. When the Run() method finishes, the underlying VM thread terminates.

 

Thread Class


ThreadId()

public method<int> ThreadId()

Parameters

None

Return Value

Returns the unique Thread ID

Description

This method returns a unique Id associated with this Thread. When the Run() method is invoked, the VM creates the underlying VM thread and assigns the Thread object the unique Id. The main thread in the script is assigned an Id of one, and the Id is incremented for each subsequent thread. Before the Run() method is executed, this method will return a value of zero..

 

Thread Class


Sleep()

public method Sleep(int Duration)

Parameters

Duration

Duration of time to sleep (milliseconds)

Return Value

None

Description

This method puts the thread to sleep for the specified duration in milliseconds. The thread can not process events while the thread is asleep.

When the time duration elapses, the thread continues executing.

 

This method can be called from another thread, telling this thread to go to sleep the next time it tries to execute a VM instruction. When the request comes in to put this thread to sleep, it may be in the process of executing a VM instruction. If so, it finishes its current VM instruction and then performs the sleep process as requested.

 

Thread Class


Suspend()

public method Suspend()

Parameters

None

Return Value

None

Description

This method suspends execution of the thread indefinitely. It can be called from within the thread being suspended, and it can also be called from another executing thread. The thread can not process events while it is suspended.

 

If this method is called from another thread, this thread will become suspended the next time it tries to execute a VM instruction. When the request comes in to suspend this thread, it may be in the process of executing a VM instruction. If so, it finishes its current VM instruction and then suspends the thread as requested.

 

Once suspended, it can be resumed by another thread invoking the Thread.Resume() method for this thread.

 

Thread Class


Resume()

public method Resume()

Parameters

None

Return Value

None

Description

This method resumes execution of the thread. It must be called from another executing thread since this thread is assumed to be suspended.

 

Thread Class


Priority()

public method<int> Priority()

Parameters

None

Return Value

Returns the current priority of the thread

Description

This method returns the current execution priority for the thread. Refer to the SetPriority() method for a list of the possible return values.

 

Thread Class


SetPriority()

public method SetPriority(int NewPriority)

Parameters

NewPriority

Specifies new priority for the thread

Return Value

NONE

Description

This method sets the new execution priority for the thread. All threads are treated as MediumPriority by default, so this method must be used if the thread priority needs to be adjusted.

 

The priority can be one of five values, specified by constants of the Thread class:

 

        LowPriority

        MediumLowPriority

        MediumPriority

        MediumHighPriority

        HighPriority

 

Use HighPriority with caution. It should not be used for tasks that run for extended periods of time, as other threads in the system may not get enough processor time. A reasonable approach is to increase it to HighPriority when a time sensitive operation is required, and then drop it back down once the operation is complete.

 

Thread Class


Script()

public method<Script> Script()

Parameters

None

Return Value

Returns a reference to the Scipt object

Description

This method returns a reference to the one and only Script object for the program. This is identical to the global GetScript() method.

 

Thread Class


IsRunning()

public method<bool> IsRunning()

Parameters

None

Return Value

Returns true if thread is running

Description

This method returns true if the current execution status of the thread is "running". Once a thread starts executing, there are only five different execution states, and they are mutually exclusive. The thread can have only one state at a time.

 

    Running - Thread is in normal VM execution mode
    Suspended - Thread is suspended until another thread wakes it up using Resume()
    Idle - Thread is in event mode with no events to process
    Shutting Down - Thread is in process of shutting down
    Terminated - The thread is shut down

 

Thread Class


IsIdle()

public method<bool> IsIdle()

Parameters

None

Return Value

Returns true if thread is waiting for incoming events

Description

This method returns true if the current execution status of the thread is "idle", meaning the thread is in event mode and it is waiting for events to process. Refer to the IsRunning() method for a description of the different states.

 

Thread Class


IsSuspended()

public method<bool> IsSuspended()

Parameters

None

Return Value

Returns true if thread is suspended

Description

This method returns true if the current execution status of the thread is "suspended". Refer to the IsRunning() method for a description of the different states.

 

Thread Class


IsShuttingDown()

public method<bool> IsShuttingDown()

Parameters

None

Return Value

Returns true if thread is shutting down

Description

This method returns true if the current execution status of the thread is "shutting down". Refer to the IsRunning() method for a description of the different states.

 

When a thread's "Run()" method terminates (for the main thread, this could also be the "Main" method), the thread's execution status is immediately set to "shutting down". For child threads, some internal cleanup is performed, including unwinding the stack (below the "EventMode()" call), and then the status is switched to "terminated". This cleanup could result in destructors being executed. For the main thread, other cleanup is also performed before the thread's status is set to "terminated", including global variable cleanup, Display system cleanup and Socket system cleanup. All of these cleanup operations can also result in destructors being executed.

 

Knowing the execution status ("shutting down" versus "terminated") might be useful for code which operates during this stack and global variable cleanup phase.

 

Thread Class


IsTerminated()

public method<bool> IsTerminated()

Parameters

None

Return Value

Returns true if thread is terminated

Description

This method returns true if the current execution status of the thread is "terminated". Refer to the IsRunning() method for a description of the different states.

 

Thread Class


EventMode()

public method EventMode()

Parameters

None

Return Value

NONE

Description

This method places the thread into a permanent event processing mode (execution status of "idle"). It waits in an efficient state for incoming events, and when an event occurs that has one or more registered event handlers, the execution status is changed to "running", an event handler is executed, and then the execution status is changed back to "idle". This method call cannot be nested. Once a thread is in "Event Mode", a subsequent call to this method is ignored.

 

This method call never returns. The stack for all methods executed below the "EventMode()" call is cleaned up during shutdown of the thread.

 

Exception handling is processed as normal within the event handlers which are executed as a result of the EventMode() call. However, exception handling does not cross the "EventMode() threshold". If an exception is fired during the execution of an event, it must be handled within the event code, otherwise the application will fail with an "unhandled exception" error. This is consistent with the behavior of "ProcessEvents()".

 

Thread Class


ProcessEvents()

public method ProcessEvents()

Parameters

None

Return Value

NONE

Description

This method interrupts the current processing within the thread and executes all queued up events in the thread. It continues executing events until there are no more to process. Once complete, execution within the thread continues immediately after the ProcessEvents() method call. This method can only be called for the thread in which the method call occurs. Calls to this method can be nested. An event handler which is executed as a result of one ProcessEvents() call can itself call the ProcessEvents() method. There is no limit to this nesting.

 

This feature is very useful when the application needs to perform a time consuming task yet still process incoming events. During the execution of a time consuming task, periodic calls to this method allow the thread to continue to be responsive to all incoming events. This provides an alternative to putting the time consuming code in a separate thread.

 

Exception handling is processed as normal within the event handlers which are executed as a result of the ProcessEvents() call. However, exception handling does not cross the "ProcessEvents() threshold". If an exception is fired during the execution of an event, it must be handled within the event code, otherwise the application will fail with an "unhandled exception" error. This is consistent with the behavior of "EventMode()".

 

Thread Class


SendTextMessage()

public method SendTextMessage(string TextMessage, int ApplicationSpecifiedId = 0)

Parameters

TextMessage

String to be sent as message to event handlers

ApplicationSpecificId

Can be any integer for the application to use any way it wants. Default value of zero.

Return Value

NONE

Description

This method sends the specified text string to the thread as a message, resulting in all registered text message event handlers to be executed. The application specified Id argument has no effect on the "send" process. It is simply an extra piece of data that the application (the "sender" of the message AND the "receiver(s)" of the message (event handlers)) can use in any way it wants.

 

Thread Class


SendBinaryMessage()

public method SendBinaryMessage(MemoryStream BinaryMessageBuffer, int NumberOfBytes = 0, int ApplicationSpecifiedId = 0)

Parameters

MemoryStream

Reference to the MemoryStream object that contains the binary data

NumberOfBytes

Specifies a max number of bytes to write, otherwise uses all data from current I/O position to end of the stream

ApplicationSpecificId

Can be any integer for the application to use any way it wants. Default value of zero.

Return Value

NONE

Description

This method sends a "binary" message to this thread. The data to be sent in the message is extracted from the MemoryStream object and sent to this thread as a message. The amount of data to be sent depends on the current I/O position within the stream, the total amount data in the stream, and value of the "NumberOfBytes" argument. If "NumberOfBytes" is zero (which is the default), the message will consist of all data from the current I/O position to the end of the stream. If "NumberOfBytes" is greater than zero, then the amount of data sent will be limited by that amount. If the total amount of data left in the stream exceeds this specified limit, then the message size is truncated at the limit. If the amount of data left in the stream is less than or equal to the limit specified (unless zero), then the remainder of the data in the stream is sent.

 

It is important to set the current position in the memory stream prior to sending the message. After data is written into the memory buffer, the stream position will be after the last write operation, by default. If the memory buffer is sent in that state, the system will try to read from it, and will fire an exception if there is no data to read. After the memory stream is filled, the stream position should be manually set to the correct position before the message is sent.

 

This results in all registered binary message event handlers (for this thread) to be executed. When a handler is executed, each handler gets its OWN copy of a MemoryStream object containing that data that was sent from the original incoming MemoryStream object. Each handler's MemoryStream object (and the data within the stream) is unique and independent of each other, as well as independent from the original stream. All changes made to the receiver's copy of the MemoryStream object affect only that object.

 

The application specified Id argument has no effect on the "send" process. It is simply an extra piece of data that the application (the "sender" of the message AND the "receiver(s)" of the message (event handlers)) can use in any way it wants.

 

Thread Class


SendObjectMessage()

public method SendObjectMessage(Base ObjectMessage, int ApplicationSpecifiedId = 0)

Parameters

ObjectMessage

Object to be sent as message to event handlers

ApplicationSpecificId

Can be any integer for the application to use any way it wants. Default value of zero.

Return Value

NONE

Description

This method sends the specified Aztec object to the thread as a message, resulting in all registered object event handlers to be executed. This can be any type of object, but the handlers can be registered on a class by class basis, so only those handlers which are applicable (based on the ObjectMessage class and an OO "is-a" comparison) will be executed. The application specified Id argument has no effect on the "send" process. It is simply an extra piece of data that the application (the "sender" of the message AND the "receiver(s)" of the message (event handlers)) can use in any way it wants.

 

Thread Class


AddExceptionHandler()

public method AddExceptionHandler(ExceptionHandler Handler, Base ExtraObject = null, Class FilterClass = null)

Parameters

Handler

Method reference to be executed when the event occurs

ExtraObject

Optional object which will be sent along to each event handler when it is executed

FilterClass

Optional filter class

Return Value

NONE

Description

This method registers a method reference to be executed when an exception is fired within this thread. An optional object can also be registered which will be sent to each event handler as it is executed.

 

This method allows the execution of the handler to be filtered based on the type of exception that was fired. If the "FilterClass" reference is not null, the handler will only be executed if the actual exception type satisfies an "is a" relationship with the class specified by the Class object. If the "FilterClass" is null, all exceptions will be handled by the registered method.

 

As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So an exception fired in one thread can be handled by event handlers executing in one or more other threads.

 

The ExceptionHandler data type represents a method reference specific to a handler for ExceptionEvent. ExceptionHandler is defined as follows:

 

        public type<method<ExceptionEvent,Base>> ExceptionHandler

 

Given this definition, the method handler must be defined with the following signature (name can be anything):

 

        public method ExceptionMethod(ExceptionEvent event, Base Extra) { }.

 

Thread Class


AddExceptionHandler()

public method AddExceptionHandler(IThread Interface, Base ExtraObject = null, Class FilterClass = null)

Parameters

Interface

Reference to an IThread object

ExtraObject

Optional object which will be sent along to each event handler when it is executed

FilterClass

Optional filter class

Return Value

NONE

Description

This method registers an IThread interface object to be executed when an exception is fired within this thread. An optional object can also be registered which will be sent to each event handler as it is executed.

 

This method allows the execution of the handler to be filtered based on the type of exception that was fired. If the "FilterClass" reference is not null, the handler will only be executed if the actual exception type satisfies an "is a" relationship with the class specified by the Class object. If the "FilterClass" is null, all exceptions will be handled by the registered method.

 

As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So an exception fired in one thread can be handled by event handlers executing in one or more other threads.

 

When an exception is fired within this thread that passes through the specified filter, the OnException() method within the IThread object will be executed.

 

Thread Class


AddTextMessageHandler()

public method AddTextMessageHandler(TextMessageHandler Handler, Base ExtraObject = null)

Parameters

Handler

Method reference to be executed when the event occurs

ExtraObject

Optional object which will be sent along to each event handler when it is executed

Return Value

NONE

Description

This method registers a method reference to be executed when a text message is sent to the thread. An optional object can also be registered which will be sent to each event handler as it is executed. Refer to the SendTextMessage() method for more details on how to send a text message.

 

As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So a message sent to one thread can be handled by event handlers executing in one or more other threads.

 

The TextMessageHandler data type represents a method reference specific to a handler for TextMessageEvent. TextMessageHandler is defined as follows:

 

        public type<method<TextMessageEvent,Base>> TextMessageHandler

 

Given this definition, the method handler must be defined with the following signature (name can be anything):

 

        public method TextMessageMethod(TextMessageEvent event, Base Extra) { }.

 

Thread Class


AddTextMessageHandler()

public method AddTextMessageHandler(IThread Interface, Base ExtraObject = null)

Parameters

Interface

Reference to an IThread object

ExtraObject

Optional object which will be sent along to each event handler when it is executed

Return Value

NONE

Description

This method registers an IThread interface object to be executed when a text message is sent to the thread. An optional object can also be registered which will be sent to each event handler as it is executed. Refer to the SendTextMessage() method for more details on how to send a text message.

 

As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So a message sent to one thread can be handled by event handlers executing in one or more other threads.

 

When a TextMessage is sent to the thread, the OnTextMessage() method within the IThread object will be executed.

 

Thread Class


AddBinaryMessageHandler()

public method AddBinaryMessageHandler(BinaryMessageHandler Handler, Base ExtraObject = null)

Parameters

Handler

Method reference to be executed when the event occurs

ExtraObject

Optional object which will be sent along to each event handler when it is executed

Return Value

NONE

Description

This method registers a method reference to be executed when a binary message is sent to the thread. An optional object can also be registered which will be sent to each event handler as it is executed. Refer to the SendBinaryMessage() method for more details on how to send a binary message.

 

As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So a message sent to one thread can be handled by event handlers executing in one or more other threads.

 

Each instance of an event handler being executed based on a single message being sent will receive its own copy of the MemoryStream object. The contents will be the same for all instances, but each instance has its own copy, so modifications to any instance of the MemoryStream object will not affect the contents of the MemoryStream objects in other event handler instances.

 

The BinaryMessageHandler data type represents a method reference specific to a handler for BinaryMessageEvent. BinaryMessageHandler is defined as follows:

 

        public type<method<BinaryMessageEvent,Base>> BinaryMessageHandler

 

Given this definition, the method handler must be defined with the following signature (name can be anything):

 

        method BinaryMessageMethod(BinaryMessageEvent event, Base Extra) { }.

 

Thread Class


AddBinaryMessageHandler()

public method AddBinaryMessageHandler(IThread Interface, Base ExtraObject = null)

Parameters

Interface

Reference to an IThread object

ExtraObject

Optional object which will be sent along to each event handler when it is executed

Return Value

NONE

Description

This method registers an IThread interface object to be executed when a binary message is sent to the thread. An optional object can also be registered which will be sent to each event handler as it is executed. Refer to the SendBinaryMessage() method for more details on how to send a binary message.

 

Each instance of an event handler being executed based on a single message being sent will receive its own copy of the MemoryStream object. The contents will be the same for all instances, but each instance has its own copy, so modifications to any instance of the MemoryStream object will not affect the contents of the MemoryStream objects in other event handler instances.

 

As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So a message sent to one thread can be handled by event handlers executing in one or more other threads.

 

When a BinaryMessage is sent to the thread, the OnBinaryMessage() method within the specified IThread object will be executed.

 

Thread Class


AddObjectMessageHandler()

public method AddObjectMessageHandler(ObjectMessageHandler Handler, Base ExtraObject = null)

Parameters

Handler

Method reference to be executed when the event occurs

ExtraObject

Optional object which will be sent along to each event handler when it is executed

Return Value

NONE

Description

This method registers a method reference to be executed when an object message is sent to the thread. An optional object can also be registered which will be sent to each event handler as it is executed. Refer to the SendObjectMessage() method for more details on how to send an object message.

 

As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So a message sent to one thread can be handled by event handlers executing in one or more other threads.

 

The ObjectMessageHandler data type represents a method reference specific to a handler for ObjectMessageEvent. ObjectMessageHandler is defined as follows:

 

        public type<method<ObjectMessageEvent,Base>> ObjectMessageHandler

 

Given this definition, the method handler must be defined with the following signature (name can be anything):

 

        public method ObjectMessageMethod(ObjectMessageEvent event, Base Extra) { }.

 

Thread Class


AddObjectMessageHandler()

public method AddObjectMessageHandler(IThread Interface, Base ExtraObject = null)

Parameters

Interface

Reference to an IThread object

ExtraObject

Optional object which will be sent along to each event handler when it is executed

Return Value

NONE

Description

This method registers an IThread interface object to be executed when an object message is sent to the thread. An optional object can also be registered which will be sent to each event handler as it is executed. Refer to the SendObjectMessage() method for more details on how to send an object message.

 

As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So a message sent to one thread can be handled by event handlers executing in one or more other threads.

 

When an ObjectMessage is sent to the thread, the OnObjectMessage() method within the IThread object will be executed.

 

Thread Class


OnException()

public method virtual OnException(ExceptionEvent Exception, Base ExtraObject)

Parameters

Exception

Exception object which was fired

ExtraObject

Optional object sent along from when it was registered

Return Value

NONE

Description

This method is the event handler for an ExceptionEvent within the thread. An event handler for an exception is usually registered from a thread separate from the thread that fired the exception. This allows the exception handler to be executed in parallel with the exceptions/handle/cleanup code which handles the exception in the thread in which it was fired. When registered, it can be filtered for certain exception event classes, or it can be registered for all exception event classes.

 

This method executes every registered handler with the same argument list which comes in. Both implementations of the Thread.AddExceptionHandler() method register the event handlers which get invoked by this method.

 

If this method is overridden by a class derived from Thread, it must call this implementation of the method if it needs to execute handlers registered with the Thread.AddExceptionHandler() methods.

 

Thread Class


OnTextMessage()

public method virtual OnTextMessage(TextMessageEvent MsgEvent, Base ExtraObject)

Parameters

MsgEvent

TextMessageEvent object associated with the event

ExtraObject

Optional object sent along from when it was registered

Return Value

NONE

Description

This method is the event handler for TextMessageEvent within the thread. It is invoked internally as a result of the Thread.SendTextMessage() method being executed. This method in turn executes every registered handler with the same argument list which comes in. Both implementations of the Thread.AddTextMessageHandler() method register the event handlers which get invoked by this method.

 

If this method is overridden by a class derived from Thread, it must call this implementation of the method if it needs to execute handlers registered with the Thread.AddTextMessageHandler() methods.

 

Thread Class


OnBinaryMessage()

public method virtual OnBinaryMessage(BinaryMessageEvent MsgEvent, Base ExtraObject)

Parameters

MsgEvent

BinaryMessageEvent object associated with the event

ExtraObject

Optional object sent along from when it was registered

Return Value

NONE

Description

This method is the event handler for BinaryMessageEvent within the thread. It is invoked internally as a result of the Thread.SendBinaryMessage() method being executed. This method in turn executes every registered handler with the same argument list which comes in. Both implementations of the Thread.AddBinaryMessageHandler() method register the event handlers which get invoked by this method.

.

Each instance of an event handler being executed based on a single message being sent will receive its own copy of the MemoryStream object. The contents will be the same for all instances, but each instance has its own copy, so modifications to any instance of the MemoryStream object will not affect the contents of the MemoryStream objects in other event handler instances.

 

If this method is overridden by a class derived from Thread, it must call this implementation of the method if it needs to execute handlers registered with the Thread.AddBinaryMessageHandler() methods.

 

Thread Class


OnObjectMessage()

public method virtual OnObjectMessage(ObjectMessageEvent MsgEvent, Base ExtraObject)

Parameters

MsgEvent

ObjectMessageEvent object associated with the event

ExtraObject

Optional object sent along from when it was registered

Return Value

NONE

Description

This method is the event handler for ObjectMessageEvent within the thread. It is invoked internally as a result of the Thread.SendObjectMessage() method being executed. This method in turn executes every registered handler with the same argument list which comes in. Both implementations of the Thread.AddObjectMessageHandler() method register the event handlers which get invoked by this method.

 

If this method is overridden by a class derived from Thread, it must call this implementation of the method if it needs to execute handlers registered with the Thread.AddTextMessageHandler() methods.

 

Thread Class


OnException()

public method virtual OnException(ExceptionEvent Exception, Base ExtraObject)

Parameters

Exception

Exception object which was fired

ExtraObject

Optional object sent along from when it was registered

Return Value

NONE

Description

This virtual method is the event handler for an ExceptionEvent within the IThread interface class. The method which overrides it is invoked for an ExceptionEvent within a Thread object when the interface object is registered with the Thread.AddExceptionHandler() method.

 

IThread Class


OnTextMessage()

public method virtual OnTextMessage(TextMessageEvent MsgEvent, Base ExtraObject)

Parameters

MsgEvent

TextMessageEvent object associated with the event

ExtraObject

Optional object sent along from when it was registered

Return Value

NONE

Description

This virtual method is the event handler for TextMessageEvent within the IThread interface class. The method which overrides it is invoked for TextMessageEvent within a Thread object when the interface object is registered with the Thread.AddTextMessageHandler() method.

 

IThread Class


OnBinaryMessage()

public method virtual OnBinaryMessage(BinaryMessageEvent MsgEvent, Base ExtraObject)

Parameters

MsgEvent

BinaryMessageEvent object associated with the event

ExtraObject

Optional object sent along from when it was registered

Return Value

NONE

Description

This virtual method is the event handler for BinaryMessageEvent within the IThread interface class. The method which overrides it is invoked for BinaryMessageEvent within a Thread object when the interface object is registered with the Thread.AddBinaryMessageHandler() method.

 

IThread Class


OnObjectMessage()

public method virtual OnObjectMessage(ObjectMessageEvent MsgEvent, Base ExtraObject)

Parameters

MsgEvent

ObjectMessageEvent object associated with the event

ExtraObject

Optional object sent along from when it was registered

Return Value

NONE

Description

This virtual method is the event handler for ObjectMessageEvent within the IThread interface class. The method which overrides it is invoked for ObjectMessageEvent within a Thread object when the interface object is registered with the Thread.AddObjectMessageHandler() method.

 

IThread Class

 

Copyright © 2010-2017

Aztec Development Group

All Rights Reserved

Download Aztec