back to index

Thread

Inheritance

Object -> Thread

Properties

affinityMask32 - W processor affinity mask
id - RW thread handle
name - RW thread name
priority - RW see THREAD_PRIORITY_xxx
userData - RW used to pass arguments to the thread function

Constants

Methods

int    create            (Function _function) - create a new thread that starts with the given function. The function object can be obtained by the <MyFunction> OR <MyModule>.<MyFunction> expressions. 
       kill              () - terminate the thread without waiting for the thread function to exit
int    getId             () 
String getName           ()
Object getUserData       () 
       setAffinityMask32 (int _processorMask) - sets processor affinity
       setName           (String _name) - set thread name (mainly for debugging purposes)
       setPriority       (int _priority) - set thread priority. See THREAD_PRIORITY_xxx.
       setUserData       (Object _o) - set arbitrary object reference
int    wait              () - wait for the thread function to return

Example

function MyThreadEntry(Thread _th) {
  /* ... */
}

Thread th;
if(th.create(MyThreadEntry))
{
   print "thread created.";
}
else
{
   print "failed to create thread.";
}

th.wait(); // Wait until thread function has returned


back to index