Listener interface overview

The Listener interface uses the Listen, CombinedListen, and CompareWatches methods to listen for single or multiple events from the resource.

There are two distinct ways to implement a listener:

  • A listener listens for a single event. If there are other listeners for the adapter, those also listen for single events. If there is any overlap in what is being listened for this, it is handled by the Resource Manager.

    For example, there might be two listeners listening on the same queue, both of which might report the same event to the Resource Manager. For this scenario, the adapter should provide a Listen method. In this instance, there is no need to provide a CompareWatches method.

  • A listener listens for multiple events. If it is not possible to have more than one listener listening on the same queue or for the same file and so on, or if it is inefficient to do so, a single listener should be provided that handles multiple events.

    For this scenario, the adapter should provide a CombinedListen method. If CompareWatches returns MPI_CMP_EQUAL, the watches that were returned as being equal are passed to the CombinedListen method.

Only one of these methods should be provided, depending entirely on whether multiple separate threads can listen for the same resource.