gtpc2m1yC/C++ Language Support User's Guide

evntc-Define an Internal Event

This function defines to the control program a named event that can be waited on by this ECB and posted by other ECBs. This function is used with the evnwc and postc functions.

Format

include   <tpfapi.h>
int       evntc(struct ev0bk   *evninf,
                enum t_evn_typ evtyp,
                char           evn_name,
                int            timeout,
                enum t_state   evstat);

evninf
A pointer to the evntc parameter block. For more information about the evntc parameter block, see struct ev0bk and struct tpf_ev0bk_list_data.

evtype
The type of event being defined. The argument must belong to the enumerated type t_evn_typ defined in tpfapi.h. Use one of the predefined terms:

EVENT_MSK
for mask events.

EVENT_CNT
for count events.

EVENT_CB_Dx
where x is a single hexadecimal digit (0-F) for core events.

EVENT_LIST
for list events.

A counter event is complete when the specified count becomes zero. The postc function decreases the event count by 1. A mask event is complete when the mask is completely reset. The postc function uses a 16-bit mask to reset the mask bits. Core block events are completed after the first postc function call. A list event is completed when all the data items have been posted.

evn_name
Indicates if the caller has supplied the event name. If Y is specified, the event name is supplied by the caller in evninf->evnbkn. If N is specified, a unique event name is generated by the function processor and returned in evninf->evnbkn.

timeout
An integer specifying the number of seconds an ECB waits before the event is assumed to be in error. The time-out parameter is a value with a range of 0 to 65 535. If 0 is specified as the time-out, the event will not time out. Note that the C API for EVNTC differs from the assembler version because the time-out parameter needs to be coded.

evstate
Indicates whether the event is run in NORM state only or in all states. Code EVNTC_1052 if the event can run in all states or EVNTC_NORM if the event can only run in NORM state.

Normal Return

Integer value of zero.

Error Return

An integer value of 1 is returned if the event name already exists.

Programming Considerations

To ensure completion of the operation, call the evnwc function.

Examples

The following example defines a count event to be named by the system with a time-out of 250 seconds, and capable of running in all system states.

#include <tpfeq.h>
struct ev0bk event_blk;

·
·
·
event_blk.evnpstinf.evnbkc1 = 1; evntc(&event_blk, EVENT_CNT, 'N', 250, EVNTC_1052);

Related Information