J
Jack
Hi,
In the code below:
#include <process.h>
unsigned __stdcall ReadThread( void *arg )
{
while( 1 )
{
cout << "RUN" << endl;
}
_endthreadex( 0 );
return 0;
}
int main( int argc, char **argv )
{
.......
HANDLE hThread;
unsigned threadID;
hThread = (HANDLE)_beginthreadex( NULL, 0, &ReadThread, NULL, 0,
&threadID ); //LINE1
if (hThread == 0) {
cout << "Failure in _beginthreadex(), errno: " << endl;
}
}
Why at LINE1, hThread is always 0, i.e., the thread is not created?
I use Visual Studio .NET 2003.
Thanks.
Jack
In the code below:
#include <process.h>
unsigned __stdcall ReadThread( void *arg )
{
while( 1 )
{
cout << "RUN" << endl;
}
_endthreadex( 0 );
return 0;
}
int main( int argc, char **argv )
{
.......
HANDLE hThread;
unsigned threadID;
hThread = (HANDLE)_beginthreadex( NULL, 0, &ReadThread, NULL, 0,
&threadID ); //LINE1
if (hThread == 0) {
cout << "Failure in _beginthreadex(), errno: " << endl;
}
}
Why at LINE1, hThread is always 0, i.e., the thread is not created?
I use Visual Studio .NET 2003.
Thanks.
Jack