📄 procmodel.c
字号:
#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <pthread.h>void* thr_fn1(void*);void* thr_fn2(void*);int main(){ pthread_t tid; if (pthread_create(&tid, NULL, thr_fn1, NULL) != 0) exit(-1); if (pthread_create(&tid, NULL, thr_fn2, NULL) != 0) exit(-1); while (1) { sleep(1); printf("Thread %d is running...\n", pthread_self()); }}void* thr_fn1(void* args){ while (1) { sleep(2); printf("Thread %d is running...\n", pthread_self()); }}void* thr_fn2(void* args){ while (1) { sleep(3); printf("Thread %d is running...\n", pthread_self()); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -