두 가지 기능이 있습니다. 어떻게 동시에 두 개의 함수를 실행할 수 있습니까? 나는 스레딩을 사용해야합니다. 멀티 스레딩의 예가 필요합니다. 당신이 원하는 경우,동시에 두 기능 실행
void CalculatePrimes()
{
// Do something
}
void TransmitFile()
{
// Do domething
}
int main()
{
std::thread x(CalculatePrices);
std::thread y(TransmitFile);
// Both function are now running an different thread
// We need to wait for them to finish
x.join();
y.join();
return 0;
}
그리고 : 당신은 당신이 std::thread를 사용할 수있는 C++ (11)에 대한 액세스 권한을 가지고있는 경우에 I 2010
당신은, 내가 실수로 내가 "비주얼 스튜디오 2010을 사용"읽을 때 그 사건이었다 가정 AfxBeginThread' – Sean
@Sean 진정한'호출하는 MFC 응용 프로그램을 작성해야합니다. 답변을 편집하여 MFC를 언급했습니다. – schumacher574