Of course you can support multiple start events. Before each start, List & Label checks if a print thread is running, and stops it if necessary with an abort event.
|
Designer-Thread |
Print-Thread |
|
Start-Event: •Copies the start parameter of the callback •Starts the print thread and waits on signal that it is ready (Event) |
|
|
|
starts: •sets process status internally to RUNNING •indicates change of state per SetEvent(hEvent) to List & Label •indicate readiness |
|
returns to List & Label |
|
From now on both the designer and preview/export run in parallel.
|
Normal designer execution. Abort •calls LlPrintAbort() for the print job and returns Status Query •returns the value of the process status Completion •calls LlPrintAbort() if necessary and waits for thread to end |
•create new job •starts print loop with changes already mentioned above When printing is complete: •set internal process state to STOPPED •indicate state change per SetEvent(hEvent) to List & Label •end job •delete project file |
It is advisable to use a unique structure for both output types, and then provide the address of the structure using LL_OPTION_DESIGNERPREVIEWPARAMETER and LL_OPTION_DESIGNEREXPORTPARAMETER to List & Label. This structure should contain:
•a pointer to a object that manages the data source (if necessary i.e. possible)
•a synchronization object (CRITICAL_SECTION)
•the thread handle of the thread in progress
•the job handle of the worker thread
•variables as copies of the start parameter
If your data source only allows single threaded access, you must set LL_OPTION_DESIGNERPRINT_SINGLETHREADED to TRUE. This will be used by List & Label, so that during the preview calculation no export is possible, and vice versa.