gtpc2m7nC/C++ Language Support User's Guide

tmslc-ECB Time Slice Facility

This function is used to enable or disable time slicing for an ECB.

When an ECB is enabled for time slicing, the ECB will lose control at defined time intervals. This allows other tasks in the system to receive control.

Format

#include   <sysapi.h>
int        tmslc(int flags, char *name);

flags
The following flags are defined in sysapi.h:

TMSLC_ENABLE or TMSLC_DISABLE
Choose only one of the previous options.

TMSLC_ENABLE
Allow the ECB to time slice.

When the entry control block (ECB) reaches the RUNTIME value, it gets suspended. The ECB will remain suspended for the value specified in the MINSUSP parameter.

Notes:

  1. RUNTIME and MINSUSP are values defined with the name parameter.

  2. If you do not specify TMSLC_HOLD and the ECB is holding a resource, the ECB will not get suspended.

TMSLC_DISABLE
Disable time slicing.

Return the ECB to normal operation.

TMSLC_HOLD
This optional parameter is valid only for the TMSLC_ENABLE option. This optional parameter indicates if the ECB can be suspended while holding a resource (fiwhc, corhc, tasnc, evnwc, or glob_lock).
Note:
This does not apply to resources held with the lockc function.

TMSLC_LETRUN
This optional parameter is valid only for the TMSLC_DISABLE option. If you code TMSLC_LETRUN, the ECB will not lose control. If you do not code TMSLC_LETRUN, the ECB will lose control unless the ECB was not enabled with TMSLC_HOLD and the ECB is currently holding a resource.

name
The time-slice name parameter is a pointer to a 1- to 8-character name. This name must be null-terminated. The time-slice name has four time-slice parameters associated with it: RUNTIME, MAXTIME, MINSUSP, and MAXECB.

The predefined time-slice names and values of the parameters associated with them are shown in Table 19.

Normal Return

The return code will be 0.

Error Return

A negative return code indicates that an error occurred:

-1
The name specified for the name parameter is not recognized.

-2
The maximum number of ECBs that can be time sliced is already active for the specified time-slice name.

Programming Considerations

Examples

The following example allows an ECB to be time sliced based on the attributes associated with the time-slice name, BIGSORT. The ECB can be time sliced even if it is holding a resource.

      #include <sysapi.h>
      void QZZ0();
         
  ·
  ·
  ·
rc = tmslc( TMSLC_ENABLE+TMSLC_HOLD, "BIGSORT" ); if (rc < 0) /* warn the user that an error occurred */ else /* start running in time slice mode */
  ·
  ·
  ·
tmslc( TMSLC_DISABLE, NULL );

Related Information

None.