8.2 Defining the Unsolicited Message Handler
To define the unsolicited message handler function, use the tpsetunsol(3c) function with the following signature:
int
tpsetunsol(*myfunc)
If you are running on Windows-based operating systems you must declare unsolicited message handler functions as:
void _TMDLLENTRY CustomerUnsolFunc(char *data, long len, long flags)
The _TMDLLENTRY
macro is required for Windows-based
operating systems to obtain the proper calling conventions between
the Tuxedo libraries and your code.
On Unix systems, the _TMDLLENTRY
macro is not
required because it expands to the null string.
The following table describes the single argument that can be
passed to the tpsetunsol()
function.
Table 8-2 tpsetunsol( ) Function Argument
Argument | Description |
---|---|
myfunc
|
Pointer to a function that conforms to the prototype of a call-back function. In order to conform, the function must accept the following three parameters:
|
When a client receives an unsolicited notification, the system dispatches the call-back function with the message. To minimize task disruption, you must code the unsolicited message handler function to perform only minimal processing tasks, so it can return quickly to the waiting process.
Parent topic: Writing Event-based Clients and Servers