TutThreadSelf


Name

TutThreadSelf — return the T_THREAD of the current thread

Synopsis

T_THREAD TutThreadSelf() 

Arguments

None

Return Values

T_THREAD value for the calling thread.

Diagnostics

None

Description

TutThreadSelf returns a T_THREAD value for the calling thread. For platforms that do not support threads, this is always equal to T_INVALID_THREAD. This value is useful primarily for comparison with other T_THREAD values as a means of establishing the identity of the calling thread.

Caution

Comparing two thread handles with the C equality operator (==) is non-portable. TutThreadEqual compares two T_THREAD values for equality. This function is necessary because some platforms use non-scalar values, such as structures, as thread handles.

See Also

TutThreadCreate, TutThreadDetach

Examples

This example checks to see if the calling thread is the arbitrarily-designated privileged thread:

static T_THREAD privileged_thread; 
 
T_BOOL check_privileged() 
{ 
  T_THREAD caller_thread = TutThreadSelf(); 
  return TutThreadEqual(privileged_thread, caller_thread); 
} 

TIBCO SmartSockets™ Utilities
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com