TutTsdSetValue


Name

TutTsdSetValue — set the value of a thread-specific data key

Synopsis

T_BOOL TutTsdSetValue(key, value) 
T_TSD_KEY key; 
T_PTR value; 

Arguments

key — a key created by TutTsdKeyCreate

value — a T_PTR value to be associated with key in the current thread

Return Values

TRUE if the association is successful, FALSE otherwise.

Diagnostics

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

Description

TutTsdSetValue sets the value associated with a thread-specific data key.

Caution

None

See Also

TutTsdGetValue, TutTsdKeyCreate

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