Home > Back-end >  To access the VCL need to use the Synchronize or change the VCL need to use
To access the VCL need to use the Synchronize or change the VCL need to use

Time:09-21

Such as I want to be in multiple threads access data in a listbox, not on the value of thread change the listbox, should do not need to use the Synchronize?

CodePudding user response:

Thread don't access interface, read write all not line,

CodePudding user response:

reference 1st floor xuchuantao17 response:
thread don't access interface, read write all not line,

There is a heap on the interface of parameters need to read in the thread, do how? The global variable? Critical section? Not to go crazy,,,

CodePudding user response:

Thread is unfavorable to the VCL, speaking, reading and writing data, global variables usually only, speaking, reading and writing.

CodePudding user response:

This kind of situation, simple recommend the use of static members, complex with synchronization, do not have direct access to the UI elements

CodePudding user response:

refer to the second floor gongyangzirui00352 response:
Quote: refer to 1st floor xuchuantao17 response:

Don't access interface, thread can't read write,

There is a heap on the interface of parameters need to read in the thread, do how? The global variable? Critical section? Not to go crazy,,,

Class definition parameters, and then passed on to the thread object
  • Related