The thread manager supports the dynamic creation and management of component-based threads. A component-based thread is a thread that executes an object (component instance) that has a 'run' method with no parameters and no results.
Get the current run interval for a thread group. The value -1 indicates no run interval, otherwise the run interval is zero or positive.
long getRunInterval ( in string group );
Get the current number of active threads for the thread group. This operation is only useful for thread groups with a zero or positive run interval.
long getThreadCount ( in string group, in boolean running );
Resume all suspended threads in the thread group. This operation is only useful for thread groups with a zero or positive run interval.
void resume ( in string group );
Set the current run interval for a thread group. The value -1 indicates no run interval, otherwise the run interval is zero or positive.
void setRunInterval ( in string group, in long seconds );
Ensure that no more than the specified number of threads are active for the thread group. This operation is only useful for thread groups with a zero or positive run interval.
void setThreadCount ( in string group, in long threads );
Start a new thread which executes the 'run' method on the 'thread' object. If the run interval for the thread group is zero or positive, it specifies a wait time between repeated calls to 'run'. If the run interval is -1 (the default), it specifies that the 'run' method should be called only once.
void start ( in string group, in Object thread );
Note: the 'thread' object can be for any component, including pre-initialized stateful components and entity components. This is useful if it is required to initialize the state of the 'thread' object before starting it in a new thread.
Stop all threads in the thread group. Each of the active threads in the thread group will stop the next time they return from 'run'. This operation is only useful for thread groups with a zero or positive run interval.
void stop ( in string group );
Note: the stop() call is equivalent to setThreadCount(0).
Suspend all threads in the thread group. Each of the active threads in the thread group will be suspended the next time they return from 'run'. This operation is only useful for thread groups with a zero or positive run interval.
void suspend ( in string group );