vassim
asked on
Threads in Cpp.NET
I have got a code sample off of the MSDN at this address
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__beginthread.2c_._beginthreadex.asp
All I want is to create a thread that waits for a key-stroke to terminate a while loop,
The sample above does exactly that and works when I run it on its own workspace, but when I try to place it into my own project, it doesnt event compile, here is what my code looks like:
void CheckKey( void *dummy );
BOOL repeat = TRUE;
void main(void)
{
......
......
_beginthread(CheckKey, 0, NULL);
while(repeat)
{
......
......
}
}
//seperate thread that waits for a key-stroke
void CheckKey( void *dummy )
{
_getch();
repeat = 0; /* _endthread implied */
}
But then I get this error:
error C3861: '_beginthread': identifier not found, even with argument-dependent lookup
I have included process.h in the project so I dont think Im missing the header file.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__beginthread.2c_._beginthreadex.asp
All I want is to create a thread that waits for a key-stroke to terminate a while loop,
The sample above does exactly that and works when I run it on its own workspace, but when I try to place it into my own project, it doesnt event compile, here is what my code looks like:
void CheckKey( void *dummy );
BOOL repeat = TRUE;
void main(void)
{
......
......
_beginthread(CheckKey, 0, NULL);
while(repeat)
{
......
......
}
}
//seperate thread that waits for a key-stroke
void CheckKey( void *dummy )
{
_getch();
repeat = 0; /* _endthread implied */
}
But then I get this error:
error C3861: '_beginthread': identifier not found, even with argument-dependent lookup
I have included process.h in the project so I dont think Im missing the header file.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
BTW had a read of that article and it explained quite a few things about threads, very good for a novice like myself,
Thanks.