AEPsetblockinghook
-establish an application-specific blocking hook function
#include <atmi.h>
int _TM_FARPROC far pascal AEPsetblockinghook(_TM_FARPROC)
AEPsetblockinghook
() is an "ATMI Extension for OS/2 Presentation Manager" that allows a OS/2 PM task to install a new function which the ATMI networking software uses to implement blocking ATMI calls. It taks a pointer to the function address of the blocking function to be installed.
A default function, by which blocking ATMI calls are handled, is included. The function AEPsetblockinghook
() gives the application the ability to execute its own function at "blocking" time in place of the default function. If called with a NULL pointer, the blocking hook function is reset to the default function.
When an application invokes a blocking ATMI operation, the operation is initiated and then a loop is entered which is equivalent to the following pseudocode:
for(;;) {
execute operation in non-blocking mode
if error
break;
if operation complete
break;
while(BlockingHook())
;
}
The default BlockingHook() function is equivalent to:
BOOL far pascal
win_default(void)
{
QMSG qmsg;
HAB hab;
BOOL ret;
/* get the next message if any */
hab = WinQueryAnchorBlock(HWND_DESKTOP);
if (ret = WinPeekMsg(hab, qmsg, NULL, 0, 0, PM_REMOVE)) {
/* if we got one, process it */
WinDispatchMsg(hab, qmsg);
}
/* TRUE if we got a message */
return(ret);
}
The AEPsetblockinghook
() function is provided to support those applications which require more complex message processing - for example, those employing the MDI (multiple document interface) model. It is not intended as a mechanism for performing general application functions. In particular, no ATMI functions may be issued from a custom blocking hook function.
AEPsetblockinghook
() returns a pointer to the function address of the previously installed blocking function. The application or library that calls the AEPsetblockinghook
() function should save this return value so that it can be restored if necessary. (If "nesting" is not important, the application may simply discard the value returned by AEPsetblockinghook
() and eventually use AEPsetblockinghook
(NULL) to restore the default mechanism.) AEPsetblockinghook
() returns NULL on error and sets tperrno
to indicate the error condition.
Under the following condition, AEPsetblockinghook
() fails and sets tperrno
to:
TPEPROTO
]
AEPsetblockinghook
() was called while a blocking operation is in progress.
This interface is supported only in OS/2 PM clients.
The blocking function is reset after tpterm
(3) is called by the application.
AEPisblocked
()