Page 1 of 1

Are Teechart (including series) threadsafe?

Posted: Sun Jun 01, 2014 11:17 am
by 16566869
Are Teechart (including series) threadsafe?
Is there any samples for that?

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

Re: Are Teechart (including series) threadsafe?

Posted: Mon Jun 02, 2014 8:08 am
by yeray
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.

Re: Are Teechart (including series) threadsafe?

Posted: Tue Jun 03, 2014 2:39 am
by 16566869
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();

Re: Are Teechart (including series) threadsafe?

Posted: Tue Jun 03, 2014 3:05 am
by 16566869
But when I add data two TFastLineseries, some AV error like attachment arose.

Re: Are Teechart (including series) threadsafe?

Posted: Tue Jun 03, 2014 3:07 am
by 16566869
If I mask "Series->Add ", it seems OK..
What is d2d1.dll, is it a part of Teechart?

Re: Are Teechart (including series) threadsafe?

Posted: Tue Jun 03, 2014 4:11 am
by 16566869
Further information, I replaced Add() with AddArray(), the error didn't arise...

Re: Are Teechart (including series) threadsafe?

Posted: Tue Jun 03, 2014 10:34 am
by yeray
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;