Use RCB_REGISTERCALLBACK() (see section 11.7.1) to register callback functions corresponding to the different classes of notification. The callback functions are called with the index of the node in question - for the CHECK and POLL messages, the char *msg parameter contains a list of users also editing the object.
A queue of received messages are kept within LIBLINCKS which is polled when you call functions in LIBLINCKS. When there are pending messages, the file handle returned by PEN_GET_HANDLE() is ``readable''. As soon as possible call the function POLL_oob() with a pointer to a non-zero integer to retreive from the DBS and dispatch the pending notification messages. By calling POLL_oob() when the file handle is readble, you complement the standard polling done upon entering any LIBLINCKS function. Under X11 use XtAppAddInput() or corresponding functions to dispatch the notification messages.
The following fragment exemplify:
/* * register the pen functions after login, as we can get pen * on following object when retrieving them a second time. * Needs to run initwindows before to setup X stuff. */ (void) RCB_REGISTERCALLBACK(RCB_PEN_RESOLVE, PEN_resolve, NULL); (void) RCB_REGISTERCALLBACK(RCB_PEN_CHECK, PEN_check, NULL); (void) RCB_REGISTERCALLBACK(RCB_PEN_POLL, PEN_poll, NULL); /* we do not want the function in usfuns.c doing any polling */ nopoll = 0; (void) RCB_REGISTERCALLBACK(RCB_PEN_NOPOLL, NULL, (void *)&nopoll); /* the last param is to passed to POLL_oob when it is called */ aimpoll = 1; if (!XtAppAddInput(app, PEN_GET_HANDLE(), (XtPointer)XtInputReadMask, POLL_oob, (XtPointer)&aimpoll)) (void)fprintf(stderr, "Failed to add PEN filehandle to Xt.\n");
In this example, we disable the normal polling of queue of pending messages by using RCB_PEN_NOPOLL. Here, we need to find out the type of the object for which we have recieved a PEN before retrieving the PEN. Since the typing necessite a few LIBLINCKS calls, we switch of the default polling. Thus, by setting the integer to a non-zero value which is passed to POLL_oob() upon invocations, we are only dequeuing PEN messages when the user interface is in a well defined state.