まあ、私はこれを行うために計画していた。c/C++:1秒ごとに変数を減らすスレッド? (Windowsの場合)
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);
}
しかし、私は、私は、Visual Studio 2008
fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory
をコンパイルしようとしたとき、私は翻訳する方法をしたい、この恐ろしい事を取得これは、ウィンドウまたはVisual Studioに私のposixスレッドを受け入れるようにします。
あなたは運が良かったですが、Windowsスレッドモデルはposixよりも豊富です! –
と、常にスレッドの必要性を避けるタイマーがあります。 –