How to access a thread variable using OmniThreadLibrary?

This seems to be a simple task, I just don't know where to start using OmniThreadLibrary:

I am creating a task that does some processing in the background. The results are stored in the fields of the task class and are constantly filled with new values.

Now the main thread wants to read these fields and display their values ​​from time to time.
Therefore, he needs to access these fields and make sure that they are not recorded at these moments (synchronization).

How can this be done using OmniThreadLibrary?

+3
source share
2 answers

/ OTL, , . (, , .)

mghie - ( ) ( ) . - :

sharedData := TSharedData.Create;
task := CreateTask(worker).SetParameter('shared', sharedData).Run;

:

sharedData := Task.Param['shared'].AsObject as TSharedData;

- " " , UpdateNow. , . , , , .

+3

OTL 23, . SetParameter() , Comm . , .

Edit:

push-, pull, , , : , , . , GUI (), SetParameter(). , , , , , , , , - reset.

+2

Source: https://habr.com/ru/post/1784764/


All Articles