SetThreadData Function

Action

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

Syntax

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.

Notes

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.

Example

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