27.04.2013 Views

MVS Jan 2005.p65 - CBT Tape

MVS Jan 2005.p65 - CBT Tape

MVS Jan 2005.p65 - CBT Tape

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The spawn() function has the drawback that the requested<br />

spawn program must reside in the USS HFS.<br />

THE PTHREAD_CREATE() FUNCTION<br />

A third multi-tasking option supported by C/C++ is the<br />

pthread_create() function. The pthread_create() function works<br />

as follows:<br />

Subtasks are created for each successfully initiated<br />

pthread_create() request.<br />

Parameters can be passed to the target program through<br />

a pthread_create() parameter.<br />

Pthread_create() can be used from either an authorized<br />

or unauthorized environment.<br />

Potential drawbacks of the pthread_create() function include:<br />

Subtask routines initiated by pthread_create() must exist<br />

in the load module of the caller, although the routines do<br />

run under a separate driver subtask program (BPXPTATT<br />

in module BPXINLPA).<br />

The environment must be POSIX(ON).<br />

There is a suite of pthread_-related function calls. Some of the<br />

more interesting and relevant ones are:<br />

Pthread_detach() – cleans up resources used for a<br />

pthread_create().<br />

Pthread_exit() – terminates the subtask initiated by a<br />

pthread_create().<br />

Pthread_join() – can be used to wait for a pthread_create()<br />

initiated subtask to complete.<br />

THE IBM C/C++ MULTI-TASKING FACILITY (MTF)<br />

A fourth multi-tasking option is the C/C++ Multi Tasking<br />

Facility. MTF works as follows:<br />

30 © 2005. Xephon USA telephone (214) 340 5690, fax (214) 341 7081.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!