Interface IEventHandler
Description
Clients of VISA COM I/O implement the interface to receive asynchronous events. Once this interface is registered via the RegisterHandler method, the VISA system calls the HandleEvent method for any events that are enabled for asynchronous delivery, generated by the resource session, and of the type that the handler was registered to receive .
There are several implementation notes for creating an IEventHandler implementation that works well with VISA COM I/O:
- The object that exports the IEventHandler interface must be a COM-compliant COM object: i.e., the IUnknown interface is fully functional, etc.
- Do not block inside the HandleEvent method. Doing so could potentially affect the liveness of the VISA COM I/O resource session object.
- Absolutely do not call any method on the session's IEventHandler interface and, preferably, do not call any resource session methods at all.
- If the object that implements the IEventHandler interface lives in a multithreaded apartment, it may receive multiple simultaneous calls to the HandleEvent method, so in that case the method should implement synchronization techniques for any heap variable access. Also, this method may be called asynchronously during client calls into the resource if the client program has multiple threads, and may even be called as a callback (on the same thread of execution) during a call. Thus, proper synchronization is strongly recommended in all cases.
Methods
Called by VISA with an Event object. |