gtpc2m5eC/C++ Language Support User's Guide

postc-Mark Event Element Completion

This function defines to the control program the completion and success of an element of a named event. This function is used with the evntc and evnwc functions.

Format

#include <tpfapi.h>
int      postc(struct ev0bk   *evninf,
               enum t_evn_typ type,
               int            ercode);

evninf
A pointer to the postc parameter block. See struct ev0bk and struct tpf_ev0bk_list_data for more information.

type
The type of event element being completed. The argument must belong to the enumerated type t_evn_typ, defined in tpfapi.h. Use the following 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.

ercode
Indicates if the post is an error post and causes the event completion to be signaled as completed with error. A value of zero indicates that the post was not an error post. A nonzero value contains the error code. The error code can range from 1-256.

Normal Return

Integer value of zero. If EVENT_CB_Dx or EVENT_LIST is coded for type, the specified core level is marked as not holding a block.

Error Return

One of the following:

Programming Considerations

Examples

The following example shows 2 ECB-controlled tasks. The first defines a count event and waits for its completion. The second task at some later time posts the completion of the event.

Task 1                                 Task 2
struct ev0bk eb =
    { { "my_event" }, 1 };
evntc(&eb, EVENT_CNT, 'Y',
    250, EVNTC_NORM);
evnwc(&eb, EVENT_CNT);
/* this task is suspended     */
/* until "my_event" completes */
                                       struct ev0bk pb =
                                           { { "my_event" } };
                                       postc(&pb, EVENT_CNT, 0);
                                       /* post "my_event" with no     */
                                       /* error                       */
/* after "my_event" completes */
/* Task 1 resumes execution   */

Related Information