Are Teechart (including series) threadsafe?

TeeChart FireMonkey (Windows,OSX,iOS & Android) for Embarcadero RAD Studio, Delphi and C++ Builder (XE5+)
Post Reply
elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Are Teechart (including series) threadsafe?

Post by elmec » Sun Jun 01, 2014 11:17 am

Are Teechart (including series) threadsafe?
Is there any samples for that?

I want to handle teechart with sth. time spending in the boost::thread ..

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

Re: Are Teechart (including series) threadsafe?

Post by Yeray » Mon Jun 02, 2014 8:08 am

Hello,

No, TeeChart isn't thread safe.
See this reply:
http://www.teechart.net/support/viewtop ... afe#p62498

Also note the "Multi-CPU Parallel Threads" section in the What's New page.
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

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: Are Teechart (including series) threadsafe?

Post by elmec » Tue Jun 03, 2014 2:39 am

Thank you.
So you mean that it is OK if handling Teechart(including series) in one thread(not only the main thread)
as following.

Code: Select all

Chart1->AutoPaint = false;
//Do sth. with Teechart and Series
Chart1->AutoPaint = true;
Chart1->Repaint();

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: Are Teechart (including series) threadsafe?

Post by elmec » Tue Jun 03, 2014 3:05 am

But when I add data two TFastLineseries, some AV error like attachment arose.
Attachments
Thread error.png
Thread error.png (30.79 KiB) Viewed 17493 times

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: Are Teechart (including series) threadsafe?

Post by elmec » Tue Jun 03, 2014 3:07 am

If I mask "Series->Add ", it seems OK..
What is d2d1.dll, is it a part of Teechart?

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: Are Teechart (including series) threadsafe?

Post by elmec » Tue Jun 03, 2014 4:11 am

Further information, I replaced Add() with AddArray(), the error didn't arise...

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

Re: Are Teechart (including series) threadsafe?

Post by Yeray » Tue Jun 03, 2014 10:34 am

Hello,
elmec wrote:So you mean that it is OK if handling Teechart(including series) in one thread(not only the main thread)
as following.

Code: Select all

Chart1->AutoPaint = false;
//Do sth. with Teechart and Series
Chart1->AutoPaint = true;
Chart1->Repaint();
Yes, this should be the way.
elmec wrote:But when I add data two TFastLineseries, some AV error like attachment arose.
We'd need a simple example project we can run as-is to reproduce the problem here to further investigate this.
elmec wrote:If I mask "Series->Add ", it seems OK..
What is d2d1.dll, is it a part of Teechart?
No, it isn't.
elmec wrote:Further information, I replaced Add() with AddArray(), the error didn't arise...
Both Add() and AddArray() call the same AddXY function. The only difference is that AddArray() calls BeginUpdate() before adding the values and EndUpdate() when finished.
So you could try with:

Code: Select all

Series->BeginUpdate;
Series->Add(yourValue);
Series->EndUpdate;
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