摘要:
使用pthread_create()函数创建两个线程,一个线程的while()循环用于刷新屏幕的内容。一个线程用于getch()函数。当getch()函数接受键盘输入后,使用pthread_exit()退出它所在的函数的线程,并使用pthread_cancel()函数将那个有while()循环的函数的线程关闭 //-lpthread//例程:#include <stdio.h>#include <pthread.h>#include <string.h>#include <sys/types.h>#include <unistd.h> 阅读全文