ct_unsubscribe
The ct_unsubscribe function cancels the subscription of a specified
thread to messages of a specified type.
Prototype:
int ct_unsubscribe( Ct_msgtype type, Ct_handle handle );
Parameters:
- type
-
A non-zero integer designating the type of message. Zero is reserved
to denote the absence of a message. Otherwise, the message types are
defined by the application.
- handle
-
Identifies the thread whose subscription to the message type is to
be cancelled. This value must have been returned from
ct_create_thread(),
ct_create_sleeping_thread(),
or ct_self(). Otherwise the results are
undefined.
Return Value:
CT_OKAY if successful, or CT_ERROR if not.
Discussion:
The ct_unsubscribe function is the opposite of
ct_subscribe(), and undoes its effects.
It cancels the specified subscription of the specified thread.
If the thread handle is not valid, or if the thread is not subscribed
to the specified message type, ct_unsubscribe() returns CT_OKAY without
doing anything.
Restrictions:
An application normally calls ct_unsubscribe() only from a thread or
user exit, i.e. while the scheduler is running. It is also possible,
though peculiar, to call ct_unsubscribe() before the scheduler
starts.
Once the scheduler has terminated, calling ct_unsubscribe() invokes
undefined behavior, since all threads have been destroyed.
Home