C语言多线程编程

2026-02-15 01:39:05

1、引入头文件:

#include <pthread.h>//开启线程相关头文件#include <stdio.h>

2、编写线程函数:

void* tprocess(void* args){

          //运行程序体         return NULL;}

3、调用线程函数:

pthread_t t;

pthread_create(&t,NULL,tprocess,NULL);

pthread_join(t,NULL);

猜你喜欢