음 (Windows에서), 나는이 일을 계획하고 있었다 : 나는 비주얼 스튜디오에서 컴파일 할 때 그러나c/C++ : 1 초마다 변수를 감소시키는 thread?
int seconds = 90;
void *DecreaseSeconds(){
while (seconds>-1)
{
seconds--;
sleep(1000);
}
return NULL;
}
int main(int argc, char *argv[]){
int threadid= pthread_create(&threads[i], NULL, DecreaseSeconds, NULL);
pthread_join(threadid, NULL);
}
나는 2008
fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory
내가 번역 할 수있는 방법을 원하는이 끔찍한 일을 얻을 이 Windows 또는 Visual Studio 내 posix 스레드를 받아 들일 수 있습니다.
행운을 빌어 요, Windows 스레딩 모델은 posix보다 훨씬 풍부합니다! –
그리고 항상 스레드가 필요없는 타이머가 있습니다. –