ct_unsubscribe_all

The ct_unsubscribe_all function cancels the subscription of a specified thread to messages of all types.

Prototype:

int ct_unsubscribe_all( Ct_handle handle );

Parameters:

handle
Identifies the thread whose subscriptions are 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_all function is a generalization of ct_unsubscribe(). Instead of cancelling a thread's subscription to a particular message type, it cancels all the subscriptions of that thread.

If the thread handle is not valid, or if the thread is not subscribed to any message type, ct_unsubscribe_all() returns CT_OKAY without doing anything.

When a thread expires, the scheduler cancels all of its subscriptions automatically.

Restrictions:

An application normally calls ct_unsubscribe_all() only from a thread or user exit, i.e. while the scheduler is running. It is also possible, though peculiar, to call ct_unsubscribe_all() before the scheduler starts.

Once the scheduler has terminated, calling ct_unsubscribe_all() invokes undefined behavior, since all threads have been destroyed.


Home