There may be cases when you need to retract a declared ptype; for example, in the CASE environment:
An installation sets up a compile server which declares itself willing to accept compilation requests when it comes up. Once the server has accepted a request, it changes state and will no longer accept new compilation requests.
A generic encapsulation process declares itself as multiple ptypes and then forwards requests to underlying tools. If an underlying tool exits, the generic wrapper no longer wants to declare itself as the ptype associated with that tool.
To unregister a ptype, use tt_ptype_undeclare. This call reverses the effect of the tt_ptype_declare call; that is, all patterns generated from the ptype are unregistered and the process is removed from the session's list of active processes with this ptype. This call returns a status of TT_ERR_PTYPE
if the named ptype was not declared by the calling process.
One invocation of tt_type_undeclare will completely unregister the ptype regardless of how many times the process has declared the ptype; that is, multiple declarations of the ptype are the same as declaring it once.
Example 10-1 is an example of how to retract a a declared ptype.
/* * Obtain procid */ tt_open(); /* * Undeclared Ptype */ tt_ptype_undeclare(ptype); |