ct_same_thread

The ct_same_thread function determines whether two thread handles refer to the same thread.

Prototype:

int ct_same_thread( const Ct_handle * pH_1, 
    const Ct_handle * pH_2 );

Parameters:

pH_1
Pointer to a Ct_handle whose contents were returned by ct_create_thread(), ct_create_sleeping_thread(), or ct_self().

pH_2
Pointer to a Ct_handle whose contents were returned by ct_create_thread(), ct_create_sleeping_thread(), or ct_self().

Return Value:

CT_TRUE if both pointers are not NULL, and point to handles that refer to the same thread; otherwise CT_FALSE.

Discussion:

This function is provided for the sake of completeness, but is not likely to find much use.

Restrictions:

The ct_same_thread function is mainly intended to be called by a thread or a user exit, i.e. while the scheduler is running. It may also be called before calling the scheduler, provided that the relevant threads have been created.

As with the ct_valid_handle function, calling ct_same_thread() invokes undefined behavior if the Ct_handles have not been properly initialized, or if the threads have been destroyed by the termination of the scheduler.


Home