SetThreadData Function


Sets the named data to the specified value and associates it with the current thread.


SetThreadData (sName, aData)
Variable Description
sName The name of this thread data—to be used to retrieve the data. STRING.
aData The data to be associated with this thread. ANYTYPE.


You can think of thread data as being a global variable associated with the thread. You provide a name for the variable so you can subsequently retrieve the data and you initialize the variable with data of any type, including a user-defined type. You can set the data or retrieve the data multiple times. You can set multiple pieces of named data for each thread. You can only get the thread data associated with the current thread.

Thread data is freed when the thread that created it is terminated.


Connect ("client1")
Connect ("client2")
SetThreadData ("Thread1", "Start one") 
UpdateDatabase ("client1") 
SetThreadData ("Thread2", "Start two")
UpdateDatabase ("client2") 
. . .