The documentation for ThreadProc
says this:
A process can determine when a thread it created has completed by using one of the wait functions. It can also obtain the return value of its ThreadProc
by calling the GetExitCodeThread
function.
So you call WaitForSingleObject
or one of the other wait functions to wait for the thread to complete. Once you know that it is complete you call GetExitCodeThread
to obtain the thread procedure's return value.
Note also that the documentation for ThreadProc
gives this as the signature for the function:
DWORD WINAPI ThreadProc(
_In_ LPVOID lpParameter
);
Your function does not have this signature, having omitted the lpParameter
argument. Because of this, the compiler would have objected to you passing a function pointer with the wrong signature. Instead of correcting the signature you chose to suppress the compiler error by using a cast to LPTHREAD_START_ROUTINE
.
This is a very bad habit to get into. Don't tell lies like this to the compiler. Simply fix the declaration of your thread procedure:
static DWORD WINAPI puneWeather(LPVOID lpParameter)
And then the expression to the right hand side of the assignment to c1_temp
looks utterly bogus. I really don't know what you are trying to achieve there, but for sure that's not the solution to any problem!