Best way to share data in an object between two threads?

WinXP, Visual Studio 2003 I have a dialog based application which consists of the main thread and a data collection thread. The main thread updates a graph from data read by the data collection thread. I want to use an object, which is of type MyData to share the data between the threads. So , basically the data collection thread which collects data from a piece of hardware and places it in the MyData object, then the main thread reads from the MyData object and updates the graph. After reading a bit on shared memory, managed mapped memory etc. in Boost, I am a bit confused on how to do this. What is the best boost classes to use for this? Will I also need a sync object to synchronize the threads? Thanks, Ed

On Sat, Apr 12, 2008 at 03:14:20PM -0600, boost@celticblues.com wrote:
What is the best boost classes to use for this? Will I also need a sync object to synchronize the threads?
Threads share all memory. Pointer from one thread points to exactly the same memory in any other thread withing the same process. You'll need some synchronization, yes.
participants (2)
-
boost@celticblues.com
-
Zeljko Vrba