The prototype of each callback type is defined in an include file.
Whether the callback parameter may be NULL
is documented for each
function which takes a callback argument.
Each call to the callback includes a DLM module id returned by the call to either
dlm_MonOpen() or
dlm_FileReadEvents()
and the value of the userData
parameter, which may be NULL
(The value, supplied by the user, is passed transparently to the callback.).
The combination can be used by the application to uniquely identify which session
each invocation of a callback refers to. Any DLM events received in the callback must be released back to the
monitor session by calling the modules release event funtion. However, events may be stored by the application and released some time after the callback returns.
The API functions that take the callback function as a parameter are,
The callback functions are not called atomically. More than one callback function can be running at the same time. If the callback functions access the same data structures, then critical sections will be needed around code that accesses those data structures.
/* prototype for callback in include file */ #include "dlmmon.h" static DlmResult Callback ( DlmMonitorId id, DlmUserData userData DlmEvent event ) { /* critical section guards stdout */ ENTER_CRITICAL_SECTION(); PrintEvent(event); LEAVE_CRITICAL_SECTION(); dlm_MonReleaseEvent(id, event); return (0); }