Jump to content

is Delphi Tool "LiveBending" ThreadSafe ?


Abaksoft

Recommended Posts

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

 

Link to comment
Share on other sites

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)

 

  • Upvote 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...