gtpc2m8j | C/C++ Language Support User's Guide |
This function waits for a named event to be completed and is similar to the
evnwc function; however, if the caller of the
tpf_sawnc function has to wait for an event to be completed, the
caller can be interrupted by a signal. The tpf_sawnc
function is used with the evntc and postc
functions.
Format
#include <tpfapi.h>
int tpf_sawnc(struct ev0bk *evninf, enum t_evn_typ type);
- evninf
- A pointer to the tpf_sawnc parameter block. See the
ev0bk and tpf_ev0bk_list_data structures for more
information about the tpf_sawnc parameter block.
- type
- The type of event being completed. The argument must belong to the
enumerated type t_evn_typ, which is defined in the
tpfapi.h header file. Use one of 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.
Normal Return
An integer value of 0.
- If this is a core block event, the core block reference word (CBRW) that
you specified for the type parameter contains the core block that
was passed by the postc function.
- If the event is count-type, the
evninf->evnpstinf.evnbkc1 structure contains the remaining
count value for the event.
- If the event is list-type, the evninf->evnbklc structure
contains the count of list items, the evninf->evnbkls structure
contains the size of a list item, and the evninf->evnbkli structure
contains the list items for the event.
- If the event is mask-type, the evninf->evnpstinf.evnbkm1
structure contains the remaining mask value for the event.
- The evninf->evnbkm2 structure contains the accumulated POST
MASK 2 for the event.
- The evninf->evnbke structure contains the error indicator if an
error has occurred, or 0 if no error has occurred.
Error Return
One of the following:
- An integer value of 1 if the event name is not found
- An integer value of 2 if the event is an error post
- An integer value of 3 if the event is interrupted by a signal.
Programming Considerations
- This function causes a loss of control for the issuing entry control block
(ECB) unless the named event is not found. The calling ECB regains
control when one of the following occurs:
- Event completion is posted (with or without error).
- A timeout occurs.
- A pending alarm is triggered, causing a SIGALARM signal to be sent.
- A signal is sent to the calling process.
- More than one 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 for the
event. Any other ECB trying to wait for the event is returned with a
not-found condition.
Examples
The following example creates an event and waits for the event to be
completed.
#include <tpfapi.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);
tpf_sawnc(&event_blk, event_type);
·
·
·
Related Information