tpunsubscribe
-unsubscribe to an event
#include <atmi.h>
int tpunsubscribe(long subscription, long flags)
The caller uses tpunsubscribe
to remove an event subscription or a set of event subscriptions from the TUXEDO System Event Broker's list of active subscriptions. subscription
is an event subscription handle returned by tpsubscribe
(3). Setting subscription
to the wild-card value, -1, directs tpunsubscribe
to unsubscribe to all non-persistent subscriptions previously made by the calling process. Non-persistent subscriptions are those made without the TPEVPERSIST bit setting in the ctl->flags
parameter of tpsubscribe
(3). Persistent subscriptions can be deleted only by using the handle returned by tpsubscribe
(3).
Note that the -1 handle removes only those subscriptions made by the calling process and not any made by previous instantiations of the caller (for example, a server that dies and restarts cannot use the wild-card to unsubscribe to any subscriptions made by the original server).
Following is a list of valid flags
.
TPNOBLOCK
tperrno
is set to TPEBLOCK
. When TPNOBLOCK
is not specified and a blocking condition exists, the caller blocks until the condition subsides or a timeout occurs (either transaction or blocking timeout).
TPNOTIME
TPSIGRSTRT
TPSIGRSTRT
is not specified and a signal interrupts a system call, then tpunsubscribe
fails and tperrno
is set to TPGOTSIG
.
Upon completion of tpunsubscribe
, tpurcode
() contains the number of subscriptions deleted (zero or greater) from the event broker's list of active subscriptions. tpurcode
may contain a number greater than 1 only when the wild-card handle, -1, is used. Also, tpurcode
may contain a number greater than 0 even when tpunsubscribe
completes unsuccessfully (that is, when the wild-card handle is used, the event broker may have successfully removed some subscriptions before it encountered an error deleting others). tpunsubscribe
returns -1 on error and sets tperrno
to indicate the error condition.
Under the following conditions, tpunsubscribe
fails and sets tperrno
to one of the following values. (Unless otherwise noted, failure does not affect the caller's transaction, if one exists.)
TPEINVAL
]
subscription
is an invalid subscription handle).
TPENOENT
]
TPETIME
]
TPNOBLOCK
nor TPNOTIME
were specified. If a transaction timeout occurred, any attempts to do new work will fail with TPETIME
until the transaction has been aborted.
TPEBLOCK
]
TPNOBLOCK
was specified.
TPGOTSIG
]
TPSIGRSTRT
was not specified.
TPEPROTO
]
tpunsubscribe
was called in an improper context.
TPESYSTEM
]
TPEOS
]
EVENTS
(5), EVENT_MIB
(5), TMSYSEVT
(5), TMUSREVT
(5), tppost
(3), tpsubscribe
(3)