CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2004
    Posts
    59

    how to get a variable parameter from another working thread in a working thread?

    I wrote a MFC multithread application. the problem is that a working thread need to get a variable parameter from another working thread. How to achieve this?

    Thanks.

  2. #2
    Join Date
    Feb 2002
    Posts
    5,757

    Re: how to get a variable parameter from another working thread in a working thread?

    PostThreadMessage()

    Kuphryn

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: how to get a variable parameter from another working thread in a working thread?

    Quote Originally Posted by Apal
    I wrote a MFC multithread application. the problem is that a working thread need to get a variable parameter from another working thread. How to achieve this?

    Thanks.
    In your case, you can have a 'data' class with thread safe setter and getter methods that you can pass between threads. You would create an instance of this class in the mfc class and pass it to each worker thread. The worker thread would cast it to the data class and use the thread safe method to retrieve or set the data.

  4. #4
    Join Date
    May 2005
    Location
    United States
    Posts
    263

    Re: how to get a variable parameter from another working thread in a working thread?

    I say it's easier to go with PostThreadMessage(). That's what I use.

    -Greg Dolley

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