gtpc2m5e | C/C++ Language Support User's Guide |
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:
- A system error with exit results if the type of post and the type of the
event do not match.
- An integer value of 1 is returned if the event name does not exist.
- An integer value of 2 is returned if a list event data item is not
found.
Programming Considerations
- For count events, evninf->evnbkm2 can contain a 16-bit mask
that is ORed with the POST MASK 2 field of the event. The current value
of the event is automatically decremented by 1 when the post request is
issued.
- For mask events, evninf->evnpstinf.evnbkm1 must contain
a 16-bit mask to be converted to a 1's complement and ANDed against the
mask value in the named event. evninf->evnbkm2 can contain a
16-bit mask to be ORed with the POST MASK 2 field in the event.
- For list events, the list contains one or more data items. All data
items in the list are posted to the list event.
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