ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Thread safety, C++
Posted by Max on Aug-04-2015 18:55
I have a Visual C++ app with several real-time chart windows, and for every single chart
window there is a single thread feeding chart images to the window in a thread-safe
manner. Each thread has its own data set and creates new chart every time it needs to
make a new chart image.
For example, XYChart* c=new XYChart(...); ... c->makeChart(...); ... delete[] c;
However, I'm not sure about thread safety of chartdir.dll, so for now there is a single
mutex for all those threads which prevents threads from building all images at one
moment. This approach works but makes multithreading useless since all charts are being
built in sequence.
Is it safe to make several charts simultaneously in different threads with ChartDirector for
C++?

  Re: Thread safety, C++
Posted by Peter Kwan on Aug-05-2015 01:54
Hi Max,

Yes. ChartDirector is thread safe, in that different chart objects can live in different
threads and can be created simultaneously without using mutex. ChartDirector is often
used in web applications. Web servers on Windows are mostly multithreaded and can
process multiple requests that create charts concurrently. So ChartDirector is designed to
be thread-safe and multithreading is very well tested in ChartDirector.

Regards
Peter Kwan