Is it dangerous to use synchronize in a non-VCL application?

后端 未结 3 912
你的背包
你的背包 2021-01-01 23:20

If Delphi code was written with synchronize to serialize access to the main VCL thread, but this code then is used in a non-VCL application, will it synchronize with the mai

3条回答
  •  感动是毒
    2021-01-01 23:35

    Since you are putting the Delphi code in a library for other apps to use, I would not advise using Synchronize() at all, since you thread has no concept of what is going on outside of itself. A better choice is to have the thread expose a callback event that the thread can call in its own context when needed, and then let the app provide a callback function handler that decides the best way to synchronize with the app's main thread as needed.

提交回复
热议问题