New Thread Constructor

Constructor for creating a thread object and associating it with the procedure executed by the thread.

New Thread(procedure_name, project_name, thread_name, stack_size)

Prerequisites

None

Parameters

procedure_name

A required String expression that specifies the name of the procedure to be executed by the thread.  This procedure must be declared as Public.  That is, the Public keyword must be specified in its definition.

This procedure must be stored in a module or in a top-level user class.  If it is in a class, it must be declared as both Public and Shared.  That is, the Public and Shared keywords must both be specified in its definition.   In addition, it must be preceded by the class name and a "." character in this parameter specification.

project_name

An optional String expression that specifies the name of the project that contains procedure_name. If this parameter is omitted, the name of the current project is assumed. Specifying this parameter is not supported by GPL at this time.

thread_name

An optional String expression that specifies the name of the thread to be created. If this parameter is omitted, the procedure_name value is used as the thread name.

stack_size

An optional numeric expression that specifies the number of kilobytes of stack to allocate for this thread. If zero or omitted, the default stack size for this project is used.

Remarks

This method does not actually create the thread in the system. It simply records the names for use by the Start method. If the procedure or project does not exist, no errors occur until the Start method is called.

Examples

Dim thread1 As New Thread(“Test”) ' Create a thread object to execute the
' Public procedure Test in the current project
Dim thread1 As New Thread(“Test”,,“Thread1”) ' Create a thread object to execute
' Public procedure Test with thread name Thread1
Dim thread1 As New Thread("MyClass.Start") ' Create a thread object
' to execute the Public Shared procedure
' named Start in the class MyClass.

See Also

Thread Class | thread_object.Start