FTAM/9000 Programmer's Guide

176 Chapter 4
Using Support Functions
Responding to Asynchronous Calls
When to Use em_hp_select()
The em_hp_select() function is a Hewlett-Packard proprietary extension
to the MAP 3.0 specification. It can be regarded as a hybrid of the MAP
3.0 em_wait() function and the HP-UX select() system call. It is located in
the common MAP library (libmap.a).
Use em_hp_select() instead of em_wait() when your application needs to
wait on MAP events, plus non-MAP events that can be represented by a
file descriptor and waited on via the HP-UX select() system call. This
may be true if your application is interactive (for example, using
asynchronous input from Terminal I/O or the X11 Window system). It
also may be true if your application needs to communicate with other
processes via named pipes or domain sockets as well as perform FTAM
operations over the OSI network.
In addition, use em_hp_select() instead of em_wait() if your application
would otherwise need em_wait() to return when interrupted by a signal.
The em_hp_select() function does not return by itself when interrupted
by a signal, but techniques exist to simulate this behavior. See the
section on handling signal interrupts with em_hp_select().
When to Use em_hp_sigio()
The em_hp_sigio() function is another Hewlett-Packard proprietary
extension in the common MAP library (libmap.a). It enables the Event
Management interface to notify your application via the SIGIO signal
when there is a MAP 3.0 event pending. However, em_hp_sigio() does not
return any MAP events itself. Therefore, it should complement your use
of em_wait() or em_hp_select().
Use em_hp_sigio() along with em_wait() or em_hp_select() when your
application needs to control the dispatch of MAP and non-MAP
components by using signals and/or semaphores to indicate when a
particular component has work to do. This is often necessary when
porting applications from other operating systems such as AT& T's
System V Unix or DEC's VMS.