#include "stdafx.h"
#include"process.h"
#include"stdlib.h"
#include"stdio.h"
#include "windows.h"
int count = 0;
void Add(void*);
void Print(void*);
int main(){
_beginthread(Add, 0, NULL);
_beginthread(Print, 0, NULL);
_endthread();
_endthread();
}
void Add(void*){
while (true){
count++;
Sleep(1000);
}
}
void Print(void*){
while (1){
printf("%d\n", count);
Sleep(500);
}
}
一个简单的C/C++多线程
最新推荐文章于 2023-06-16 16:25:35 发布