gtpc2m1z | C/C++ Language Support User's Guide |
This function waits for the completion of a named event. It is used
with the evntc and postc functions.
Format
#include <tpfapi.h>
int evnwc(struct ev0bk *evninf, enum t_evn_typ type);
- evninf
- A pointer to the evnwc parameter block. For more information about
the evnwc parameter block, see struct ev0bk
and struct tpf_ev0bk_list_data.
- type
- The type of event being completed. 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.
Normal Return
An integer value of zero.
- If this is a core block event, the CBRW specified by the type
parameter contains the core block passed by the postc macro.
- If the event is count-type, evninf->evnpstinf.evnbkc1
contains the remaining count value for the event.
- If the event is list-type, evninf->evnbklc contains the count
of data items in the list, evninf->evnbkls contains the size of a
data item, and evninf->evnbkli contains the list data items for the
event.
- If the event is mask-type, evninf->evnpstinf.evnbkm1
contains the remaining mask value for the event.
- evninf->evnbkm2 contains the accumulated POST MASK 2 for the
event.
- evninf->evnbke contains the error indicator if an error has
occurred, or zero if no error has occurred.
Error Return
One of the following:
- An integer value of 1 is returned if the event name is not found.
- An integer value of 2 is returned if the event is an error post.
Programming Considerations
- The evnwc function suspends the issuing ECB until the specified
event completes, either by being posted or by timing out.
- Issuing the evnwc function causes an unconditional loss of
control for the issuing ECB unless the named event is not found.
- More than 1 ECB is allowed to wait for the same named event except for
core block events. When the event is completed, all waiting ECBs are
posted. For a core block event, only the creating ECB can wait on the
event. Any other ECB attempting to wait on the event is be returned
with a not-found condition.
Examples
The following example creates an event and waits for the event to
complete.
#include <tpfeq.h>
struct ev0bk event_blk;
enum t_evn_typ event_type;
char caller_provided_name;
int event_timeout;
enum t_state event_state;
·
·
·
evntc(&event_blk, event_type, caller_provided_name, event_timeout,
event_state);
evnwc(&event_blk, event_type);
Related Information