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

Thread: thread return

  1. #1
    Join Date
    Oct 2008
    Posts
    45

    thread return

    where does the number returned by the thread function goes???

  2. #2
    Join Date
    Nov 2007
    Location
    Birmingham, England
    Posts
    157

    Re: thread return

    This is platform dependent.

    In windows you can use the GetExitCodeThread Function to retreave the return value.

    Hope this helps.

  3. #3
    Join Date
    Oct 2008
    Posts
    45

    Post Re: thread return

    I'll have to try it but it seems like the right function.
    for future reference I want to know the return value cause what I'm doing is returning an address to a variable I need to use in the main;

    Code:
    unsigned __stdcall foos(void *param)
    {
    	char *fName=(char*)param;
    	ifstream in(fName);
    	int *ret=getStatistics(in);
    	return reinterpret_cast<unsigned>(ret);
    }
    now in main:

    uintptr_t th1=_beginthreadex(NULL,0,foo1,NULL,0,NULL);
    int *stat=reinterpret_cast<int*>(getreturn(th1));//getreturn fictional function just to illustrate my intentions

    thanks "couling"
    Last edited by compuKidd; December 14th, 2008 at 05:40 PM. Reason: forgot detail

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