tsyncro() — Wait for MTF subtask termination

Standards

Standards / Extensions C or C++ Dependencies
Language Environment C only  

Format

#include <mtf.h>

int tsyncro(int MTF_ANY|MTF_ALL|nn);

General description

Waits for termination of parallel functions under MVS.

To avoid infringing on the user's name space, this nonstandard function has two names. One name is prefixed with two underscore characters, and one name is not. The name without the prefix underscore characters is exposed only when you use LANGLVL(EXTENDED).

To use this function, you must either invoke the function using its external entry point name (that is, the name that begins with two underscore characters), or compile with LANGLVL(EXTENDED). When you use LANGLVL(EXTENDED) any relevant information in the header is also exposed.

The tsyncro() library function causes the main task to wait for the first subtask, a particular subtask, or all subtasks to finish executing all of the parallel functions that have been scheduled for them. You can monitor the completion of any, all, or a specific subtask by specifying:
MTF_ANY
To wait for the completion of any subtask.
MTF_ALL
To wait for the completion of all subtasks.
nn
To wait for the completion of the subtask having a task_id of nn. See tinit() — Attach and initialize MTF subtasks for a description of task_id.

You can invoke tsyncro() from your main task program as often as necessary.

If tinit() is called by a program running under IMS, CICS, or DB2, the request will not be processed and the returned value will indicate that MTF calls are not supported under these systems.

Note: This function is not supported under the z/OS® UNIX with the POSIX(ON) runtime option.

Returned value

If successful, tsyncro() will always return a value suitable for use as a target task on a subsequent tsched(). In particular, the return codes on success depend on the nature of the tsyncro() call, and the state of the subtasks at the time of the tsyncro() call as follows:
Task_id passed to tsyncro() Return code (if successful)
MTF_ANY (and at least one subtask not previously returned from a tsyncro()) nn = task_id of first subtask to become free
MTF_ANY (and all subtasks have previously been returned from a tsyncro()) MTF_ANY
MTF_ALL MTF_ANY
nn = task_id nn
If tinit() has not been successfully called before the tsyncro() call, tsyncro() indicates that MTF is inactive and returns one of the following values:
Error Code
Description
EINACTIVE
MTF is inactive.
ETASKABND
One or more subtasks have terminated abnormally.
ETASKID
The task_id argument specified is out of range.
Note: These values are macros. They can be found in the mtf.h header file.

Related information