Page 1 of 1

TeeChart v8 and multithreading

Posted: Fri Dec 07, 2012 11:06 am
by 15047307
In this forum it has been made clear that TeeChart is not thread safe in a sense that data in series or TeeChart cannot be updated from other threads if TeeChart is being drawn.

Is it possible and safe however to update data in series and add new series from multiple threads if TeeChart is not being drawn i.e. automatic drawing is disabled and drawing is requested by client code? Is TeeChart’s series object container class access thread safe f.ex. by using critical sections in TeeChart code? I am aware that handling series removal from TeeChart if multiple threads are running is a bit of a challenge for client code because series’ indexes may change as a result but if we dismiss that and assume that adding a new series to TeeChart is not changing existing series’ indexes i.e. new series are always added to the tail of the TeeChart’s series object container class, is this scenario possible?

We are using TeeChart Pro v8 ActiveX control.

Re: TeeChart v8 and multithreading

Posted: Mon Dec 10, 2012 10:24 am
by yeray
Hello,

Yes, disabling the AutoRepaint feature you can use semaphores (or any other threading technique) to safely add points or series in a thread, and repaint the chart in another thread. You just have to make sure both actions won't be made at the same time.
Don't hesitate to let us know if you find any problem implementing it.

Re: TeeChart v8 and multithreading

Posted: Tue Dec 11, 2012 7:04 am
by 15047307
Thank you for the information. One additional question: is it safe to add points to different series from multiple worker threads simultaneously if the painting is disabled?
We are planning to create a thread pool where each thread adds points to a single series to speed up the graph updating for large amounts of data.

Re: TeeChart v8 and multithreading

Posted: Tue Dec 11, 2012 10:34 am
by yeray
Hello,
jhameenniemi wrote:is it safe to add points to different series from multiple worker threads simultaneously if the painting is disabled?
I think it should. In general, different series don't have relations between them.
Only the functions are linked to a series, which at the same time are linked to source series.