Using AIX Event Infrastructure for polling
AIX® Event Infrastructure does not require that event producers always maintain the current value of events which may be monitored.
This is to allow for greater performance since event producers do not have the overhead of maintaining this value if no one is monitoring for occurrences of the event.
This creates a problem when using synchronous polling. Since it is not always possible to obtain the current value of an event at every point in time, poll() or synchronous select() calls are handled in the following way:
- When a process issues select() or poll() on a monitor
file for the first time, the AIX Event
Infrastructure kernel extension will register that event for monitoring
with the event producer.
- For threshold value event producers who do maintain the current value, the current value will be returned to the AIX Event Infrastructure kernel extension upon event registration. This value will be checked against the consumer threshold value at this time. If the consumer's threshold has been exceeded, the select() or poll() will indicate that the event has occurred and will have an RC_FROM_EVPROD of EALREADY.
- POLLSYNC flags are ignored. An event remains registered with the event producer until the event occurs the specified number of times, or until the user closes the file.
- Subsequent poll() calls will have the following behavior:
- If the event has not yet occurred, the call will return with no return events
- If the event has occurred the specified number of times since the last poll() call, return events will be set to indicate that the event has occurred.