qfedu-linux-advanced-level/day6/thread1.c

10 lines
327 B
C
Raw Permalink Normal View History

2023-08-21 19:45:29 +08:00
#include <stdio.h>
#include <pthread.h>
int main()
{
printf("当前线程号: %ld", pthread_self()); // 获取当前线程号
char test_char = getchar(); //阻塞程序的执行,等待用户输入一个字符后才会继续执行后面的代码
printf("获取到 %c\n", test_char);
return 0;
}