CBL_THREAD_LIST_NEXT

Used in conjunction with CBL_THREAD_LIST_START and CBL_THREAD_LIST_END to obtain a list of all currently existing threads that the run-time system knows about. The CBL_THREAD_LIST_NEXT call takes returns the next item in the list of threads.

Syntax:

call "CBL_THREAD_LIST_NEXT" using by reference thread-id
                            by reference       thread-state
                            by reference       thread-iddata

Parameters:

  Using call prototype (see Key) Picture
thread-id cblt-pointer usage pointer.
thread-state cblt-x4-compx pic x(4) comp-x.
thread-iddata cblt-pointer usage pointer.

On Entry:

None

On Exit:

thread-id
First thread identifier in this routine's internal list
thread-state
The state of the thread:
Bit 0
0 Not detached
1 Detached
Bit 1
0 Not suspended.
1 Suspended by CBL_THREAD_SUSPEND
Bit 2
0 Thread is not the main thread.
1 Thread is from a program in another language, and is known to the run-time system, or is the main thread
Bits 3-31
Undefined; could be any value
thread-iddata
A pointer to the thread's id-data, if that data area exists (otherwise NULL). id-data is specified by the routine CBL_THREAD_ALLOC_IDDATA.
return-code
A value indicating success or otherwise. See RETURN-CODE Values For Thread-control Routines

Comments:

Only information on existing threads, that is, threads that have not terminated, is returned. This routine will not return a thread-id for a thread that has terminated but has not been detached.

If thread-id is NULL then the first item in the list is returned (but there must have been a previous CBL_THREAD_LIST_START call).

Behavior is undefined if thread-id is invalid.