Writing Monitors for the Event Monitoring Service (December 1999)
Chapter 3 125
Creating a Resource Monitor
Processing a Terminate Event
Processing a Terminate Event
The Terminate Event is a signal from the EMS API that no activity has
been detected that required the attention of the resource monitor for a
significant period of time (defined to be 60 minutes). The resource
monitor may call rm_monitor_stop() and shut down.
Any message received from the Registrar will reset the termination
timer. If a monitor request is registered, the timer will not be used. (If
the resource monitor has been asked to monitor a resource, it should not
shut down.)
Traffic on the resource monitor’s file descriptors will not reset the
termination timer. That is, if a resource monitor is not sending or
receiving messages to the EMS API, it will be notified to shut down.
The resource monitor may choose to ignore the Terminate Event if there
is some reason it should not terminate.
No object is created by rm_get_next_event() when the event type is
RM_TERMINATE_EVENT. If the resource monitor chooses to ignore this
event, the obj variable does not need to be destroyed.
Sample Code
This code fragment shows how a resource monitor might respond to a
Terminate Event.
/*****************************************************************************/
/* File: process_requests.c */
/* */
/* The main loop for the sample monitor. */
/*****************************************************************************/
#include <monitor.h>
/*
* Resource monitor: process_requests
* Desc:
* Receives and processes events until a Terminate Event is received.
* Parms:
* None
* Returns:
* Only upon error.
*/