Abaksoft Posted July 11, 2015 Posted July 11, 2015 Hi Farshad, To simplify coding, i am using LiveBinding on my UniFrame (which is thread safe). Now, is LiveBindings ThreadSafe ? in the uses i see : System.Bindings.Outputs, Vcl.Bind.Editors, Vcl.Bind.DBEngExt, Data.Bind.Components, Data.Bind.DBScope, Data.Bind.EngExt, System.Rtti; It works fine on my computer (exe file). But what happens in production (dll on a server) ? Thx... Delphi XE3 + 0.99.1182 Quote
ZigZig Posted July 13, 2015 Posted July 13, 2015 Hi Abaksoft, According to this article, the answer is no : No, LiveBindings is not thread safe. The business object property setter, the LiveBindings notification, expression evaluation, setting the property of the destination control/object, and even things like the OnChange event handler for the control are executed in the context of the calling thread that changed the original BO property. But SendMessage is often used in standard and common controls when changing properties that have a visible effect (such as TEdit.Text, TScrollBar.Position and so on) in which case the GUI repaint occurs in the context of the main thread (which processes the message loop). What this means is that you might get away with simple scenarios but in most cases you will need to manage the threads carefully. Because the BO doesn’t (and shouldn’t) directly know what it is bound to a simple solution would be to synchronize all threads with a wrapper TBindings.Notify call. Hardly efficient but neither is the necessarily complex LiveBindings system. (Jarrod Hollingworth) 1 Quote
Abaksoft Posted July 13, 2015 Author Posted July 13, 2015 Oh !!! ...un grand merci zigzig I will use now DB controls instead. All the best ! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.