Solved

Threads in Cpp.NET

Posted on 2004-04-29
2
357 Views
Last Modified: 2007-12-19
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.
 
0
Comment
Question by:vassim
2 Comments
 
LVL 30

Accepted Solution

by:
mayankeagle earned 30 total points
Comment Utility
0
 

Author Comment

by:vassim
Comment Utility
Its Ok now, I compared the project properties and I found in "Check for 64 bit portability issues" If I change to "No" then it works. I dont know why, but it works and thats the main thing.
BTW had a read of that article and it explained quite a few things about threads, very good for a novice like myself,
Thanks.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now