CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Jun 2009
    Location
    oklahoma
    Posts
    199

    Multiple Threads with same variable

    Here is what I want to happen:

    Create a background thread that polls a DAQ and constantly updates variable VOLTAGE.
    Main thread just retrieves latest value stored in VOLTAGE.

    I don't really care about synchronization or anything. The two threads are completely independent except the VOLTAGE variable.

    Is there any problem with this? How does a computer write to memory... does it write it "bit by bit" ? e.g. is it possible for the main thread to read a half-way updated VOLTAGE value and get incorrect data?

    Initial tests seem rock solid, but want to make sure...

    Thanks!

    Edit: VOLTAGE is just a float array...
    Last edited by jnmacd; September 21st, 2010 at 01:36 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured