Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

ATTACH statement

Examples

A thread is attached (or created) by the execution of the ATTACH statement. You can specify explicit characteristics for the thread if the defaults are not desired.

Read syntax diagramSkip visual syntax diagram>>-ATTACH--entry-reference--+--------------------------+-------->
                            '-THREAD--(task-reference)-'
 
>--+-----------------------------------------+--;--------------><
   '-ENVIRONMENT--(-+--------------------+-)-'
                    '-TSTACK(expression)-'
 
entry
Specifies the name of a limited entry variable, or the name of an external entry or level-1 procedure. It cannot be the name of an internal procedure or a fetchable procedure. The ATTACHed entry must be declared as having no parameters or as having exactly one BYVALUE POINTER parameter. However, you can fetch a procedure, assign it to a limited entry variable, and then attach the entry variable as a thread.

Arguments can be passed to the new thread just as you would pass arguments to a synchronous entry in a CALL statement.

THREAD (task reference)
Specifies the name of a task variable that becomes associated with the thread. The task variable can then be used to refer to the thread.

Unless explicitly declared, the named variable is given a contextual declaration.

If the THREAD option is not specified, the attached thread cannot be stopped or waited upon by another thread.

If a thread is attached with the THREAD option, it should be detached using the DETACH statement (see Detaching a thread) to free all the system resources associated with the thread.

Operating system services must not be used directly to create a thread.

ENVIRONMENT (abbrev: ENV)
Specifies environmental characteristics and is usually operating system dependent.
TSTACK (expression)
On Intel, specifies the size of the stack to be used for the attached thread. The expression should be FIXED BINARY(31,0). If the stack size is not specified, the run-time default will be used.

On z/OS, TSTACK is ignored, and the size of the stack is determined by LE.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)