Spawning Child Threads

Initially, the main thread validates all input parameters. If any issues arise, it generates an error message and terminates.

Once all parameters pass validation, the main thread deactivates cube logging for the target cube, a task specifically assigned to the main thread to avoid potential locking problems.

The main thread then determines if parallel execution is required by verifying if pMaxThreads > 1.

If parallel execution was required, the main process sets up the }APQ C3 Thread Control cube for thread status monitoring. This involves clearing a specific cube slice based on the current user and current process and setting the status of all child threads to Scheduled. The main thread (pThreadID = 0) is marked as Scheduled and Running, but not Completed.

Following this, the main thread spawns all child threads using the RunProcess command with the same process name. The pThreadID for each thread is designated a value ranging from 1 to the pMaxThreads parameter. All other parameters remain unchanged for the child threads.

Based on settings in }APQ Settings, the main thread either transitions directly to the thread monitoring loop in the epilog or begins its data processing task. Once it has completed data processing, it moves to the thread monitoring loop in the epilog.

If parallel execution wasn't required, the entire data processing occurs in a single-threaded mode, solely handled by the main thread.