The IOMGR package allows light-weight processes to wait on
various Unix events. IOMGR_Select allows a light-weight process to
wait on the same set of events that the Unix
select
call waits on. The parameters to these routines are the same.
IOMGR_Select puts the caller to sleep until no user processes are
active. At this time the IOMGR process, which runs at the lowest
priority, wakes up and coaleses all of the select request together.
It then performs a single
select
and wakes up all
processes affected by the result.
The IOMGR_Signal call allows a light-weight process to wait on delivery of a Unix signal. The IOMGR installs a signal handler to catch all deliveries of the Unix signal. This signal handler posts information about the signal delivery to a global data structure. The next time that the IOMGR process runs, it delivers the signal to any waiting light-weight processes.
select
;
void rpc2_SocketListener () { int ReadfdMask, WritefdMask, ExceptfdMask, rc; struct timeval *tvp; while (TRUE) { . . . ExceptfdMask = ReadfdMask = (1 < < rpc2_RequestSocket); WritefdMask = 0; rc = IOMGR_Select (8*sizeof(int), & ReadfdMask, & WritefdMask, & ExceptfdMask, tvp); switch (rc) { case 0: /* timeout */ continue; /* main while loop */ case -1: /* error */ SystemError ("IOMGR_Select"); exit (-1); case 1: /* packet on rpc2_RequestSocket */ . . . process packet . . . break; default: /* should never occur */ } } }
void IOMGR_Initialize( )
None.
All went well,
Not enough free space to create the IOMGR process,
Something went wrong with other init calls,
This call will initialize the IOMGR package. Its main task is to create the IOMGR process, which runs at priority 0, the lowest priority. The remainder of the processes must be running at priority 1 or greater for the IOMGR package to function correctly. )
void IOMGR_Finalize( , )
None.
Package finalized okay,
This call cleans up when the IOMGR package is no longer needed. It releases all storage and destroys the IOMGR process.
( )
IOMGR_Select( @w < in int fds > , @w < in out int *readfds > , @w < in out *writefds > , )
Maximum number of bits to consider in masks,
Mask of file descriptors that process wants notification of when ready to be read,
Mask of file descriptors that process wants notification of when ready to be written,
Mask of file descriptors that process wants notification of when exceptional condition occurs,
Timeout for use on this selectrip >
This function performs an LWP version of Unix select . The parameters have the same meanings as the Unix call. However, the return value will only be -1 (an error occurred), 0 (a timeout occurred), or 1 (some number of file descriptors are ready). If this is a polling select, it is done and IOMGR_;Select returns to the user with the results. Otherwise, the calling process is put to sleep. If at some point, the IOMGR process is the only runnable process, it will awaken and collect all select requests. It will then perform a single select and awaken those processes the appropriate processes -- this will cause return from the affected IOMGR_;selects.
IOMGR_Signal( @w < in int signo > , @w < in char *event > , )
The unix signal number, as defined in signal.h,
The light-weight process event that should be signaled whenever signo is delivered
No problems.,
signo was out of range,
event was zero,
This function associates an LWP signal with a Unix signal. When the Unix signal signo is delivered to the process, the IOMGR process will deliver an LWP signal to the event event via LWP_;NoYieldSignal, waking any light-weight processes waiting on that event. Multiple deliveries of the signal may be coalesed into one LWP wakeup. The call to LWP_;NoYieldSignal will happen synchronously. It is safe for an LWP to check for some condition and then go to sleep waiting for a Unix signal without having to worry about delivery of the signal happening between the check and the call to LWP_;WaitProcess.
IOMGR_;CancelSignal( @w < in int signo > , )
The Unix signal that should no longer be converted.
The association was cancelled,
signo is out of range or LWP_Signal has not been called on it,
This function cancels the association of a Unix signal and an LWP event. After calling this function, the Unix signal signo will be handled however it was handled before the corresponding call to LWP_Signal.