Process and Threads.

These routines facilitate the control over new processes and threads within the JCC library.

char __subtask [9] = "SUBTSKxx"; where xx is a system generated hexadecimal value, may be changed to a unique alphanumeric string of length 6 when one multi-threaded JCC program launches another (since the operating system will not allow multiply defined system symbols.)

New processing in the JCC thread library attempts to find a unique "SUBTSnxx" value by trying digits 0 through to 9 in position 'n', when starting a new thread fails due to a conflict.

Routine Use
_beginthread Start a new thread of execution
_endthread Signal that the current thread has finished
EnterCriticalSection Wait for the availability of a critical section object
InitialiseCriticalSection Initialise a critical section object
LeaveCriticalSection Give up ownership of a critical section object
Sleep Suspend execution for a specific length of time
CreateEvent Returns a handle to a new event object
ResetEvent Resets an event object to the non-signalled state
SetEvent Sets an event object to the signalled state, waking sleeping subtasks
EventStatus Returns the signalled state of the event
WaitForSingleEvent Suspend execution until an event is signalled
WaitForMultipleEvents Suspend execution until multiple events are signalled
CloseEvent Deallocates the data structures used to create an event object
spawn Run a program in a new thread, using a parameter list
spawnc Run a program in a new thread, using a command line
_syncthread Wait for a thread to finish, and release its allocated resources
system Run a program in the current thread, waiting for the result
systemTSO Run a program with a CPPL in the current thread, waiting for the result
_threadpriority Calls the O/S CHAP service for a thread or program
_threadstatus Calls the O/S STATUS service for a thread