abandon an outstanding call
#include <atmi.h>
int tpcancel(int cd);
tpcancel() abandons an outstanding call descriptor: the caller will never collect its reply. The descriptor is released immediately; if the service reply arrives later it is discarded and the application log may note it.
| Argument | Description |
|---|---|
| cd | A call descriptor returned by tpacall() that has not been replied to or cancelled yet. |
| Code | Description |
|---|---|
| TPEBADDESC | cd is not an outstanding call descriptor. |
| TPESYSTEM | Platform failure. |
Full source: docs/api/examples/cancel.c
(build and run with make -C docs/api/examples check
TUXDIR=<install>); the lines documenting tpcancel() are highlighted.
// tpcancel() example: abandon an outstanding call; the late reply is
// discarded by the client library when it arrives.
#include <stdio.h>
#include <string.h>
#include <atmi.h>
int main(int argc, char **argv) {
const char *input = argc > 1 ? argv[1] : "hello";
char *req = tpalloc("STRING", NULL, strlen(input) + 1);
if (req == NULL) {
fprintf(stderr, "tpalloc failed: tperrno=%d\n", tperrno);
return 1;
}
strcpy(req, input);
int cd = tpacall("TOUPPER", req, 0, 0);
if (cd == -1) {
fprintf(stderr, "tpacall failed: tperrno=%d\n", tperrno);
tpfree(req);
return 1;
}
if (tpcancel(cd) == -1) {
fprintf(stderr, "tpcancel failed: tperrno=%d\n", tperrno);
tpfree(req);
return 1;
}
printf("cancelled cd=%d\n", cd);
tpfree(req);
return 0;
}
fuxedo: supported. Cross-checked against Oracle Tuxedo 12.2.2 and 22.1 with the API hardening suite.