TutTsdGetValue


Name

TutTsdGetValue — get the value of a thread-specific data key

Synopsis

T_BOOL TutTsdGetValue(key, value_return) 
T_TSD_KEY key; 
T_PTR *value_return; 

Arguments

key — a key created by TutTsdKeyCreate

value_return — location of a T_PTR into which the associated value is stored

Return Values

TRUE if key exists and is set to a non-NULL value, FALSE otherwise.

Diagnostics

If TutTsdGetValue fails, it returns FALSE and sets the global SmartSockets error number to one of:

Description

TutTsdGetValue gets the value associated with a thread-specific data key.

Caution

A FALSE result is not necessarily an error — it may just be that the value of the TSD key requested is NULL. This is intended as a convenience for initializing TSD values.

See Also

TutTsdKeyCreate, TutTsdSetValue

Examples

This example retrieves a two-element integer array associated with a TSD key. If the key’s value has not been initialized, it is set.

T_TSD_KEY my_array_key; /* created previously */ 
T_INT4 *my_array; 
. 
. 
. 
if (!TutTsdGetValue(my_array_key, &my_array)) { 
  my_array = (T_INT4 *)TutMalloc(sizeof(T_INT4) * 2); 
 
if (!TutTsdSetValue(my_array_key, my_array)) { 
    /* error */ 
  } 
} 

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