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.
Chart multiple threads access
Re: Chart multiple threads access
Hi PoLabs,
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.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.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Chart multiple threads access
I will pay attention to that. I also soved my problem and it was not related to threads. Thanks for reply and suggestion.
Re: Chart multiple threads access
Hi PoLabs,
You're welcome! I'm pleased to hear that you've solved it.
You're welcome! I'm pleased to hear that you've solved it.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |