Chart multiple threads access

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
PoLabs
Newbie
Newbie
Posts: 35
Joined: Fri Feb 05, 2010 12:00 am

Chart multiple threads access

Post by PoLabs » Wed Jun 16, 2010 3:07 pm

Hi,

I have a question regarding usage of teechart within multiple threads. I have two chart which are very similar one to each other. Actually one is descendant of other. The descendant chart has logarithmic bottom scale. I have vertical cursors on both. If I move cursor on ascendant chart everything works ok regardless if i move cursor on descendant chart i get teechart access violation which happens somewhere in teechart. It is also very hard to catchbug while it is not always possible to repeat it. Sometimes works and sometimes it crashes. I isolated almost everything and now I am suspecting that there must be somehow multi thread access problem. I have one thread which is populating graphs with some data and other thread does the rest job (mouse events etc...) Is it possible to lock chart that only one thread would have access at same time? Something similar like with critical section.

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Chart multiple threads access

Post by Yeray » Thu Jun 17, 2010 2:59 pm

Hi PoLabs,
PoLabs wrote:I have one thread which is populating graphs with some data and other thread does the rest job (mouse events etc...) Is it possible to lock chart that only one thread would have access at same time? Something similar like with critical section.
I'm afraid that TeeChart isn't thread safe. This means that you should ensure that the repainting of the chart isn't interfered with an addition of a point. To do this, you should set autorepaint property to false and pause the "acquiring data thread" before repainting the chart (Chart1.Repaint) and let it continue when the repaint has finished, for example using semaphores.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

PoLabs
Newbie
Newbie
Posts: 35
Joined: Fri Feb 05, 2010 12:00 am

Re: Chart multiple threads access

Post by PoLabs » Fri Jun 18, 2010 7:12 am

I will pay attention to that. I also soved my problem and it was not related to threads. Thanks for reply and suggestion.

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Chart multiple threads access

Post by Yeray » Fri Jun 18, 2010 11:10 am

Hi PoLabs,

You're welcome! I'm pleased to hear that you've solved it.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply