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

Threaded View

  1. #1
    Join Date
    Jul 2003
    Location
    PA
    Posts
    124

    syntax for thread that returns a value

    Ok, I need to create a thread function uses the comm port that is passed a single parameter (char[16]), and it is to return a char * (LPSTR) value.

    I already have the comm port functionality completed and this works fine as a single threaded app. I need to port it to a multi-threaded app.

    I looked at all of the documentation that I can find, but cannot get a grip on how to get a value back from the thread function.

    CreateThread() is passed the function name and params (a struct of type LPVOID, another problem area), but the return value from the CreateThread is the thread ID. How can:
    1. Pass the char[16] param to the thread
    2. get the LPSTR value returned from the thread comm function.
    3. This value MUST be returned prior to procedding with further processing. I am contemplating the use of WaitForSingleObject(...) but am unsure of the downside of it.

    An example would be tremendously helpful.

    Thanks in advance...
    Last edited by rick7423; June 2nd, 2005 at 09:35 AM.
    There are 10 types of people in the world, those that understand binary and those that don't.
    Using VS 2010

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