这篇文章介绍Linux下线程的创建与基本使用案例,主要是案例代码为主;相关的函数详细介绍在上篇文章里已经介绍过了。
1. 案例代码: 线程的创建下面这份代码演示如何创建线程。在编译的时候需要加上-lpthread
函数原型:
#include
int pthread_create
(
pthread_t *thread,
const pthread_attr_t *attr,
void *(*start_routine)
这篇文章介绍Linux下线程的创建与基本使用案例,主要是案例代码为主;相关的函数详细介绍在上篇文章里已经介绍过了。
1. 案例代码: 线程的创建下面这份代码演示如何创建线程。在编译的时候需要加上-lpthread
函数原型:
#include
int pthread_create
(
pthread_t *thread,
const pthread_attr_t *attr,
void *(*start_routine)
微信扫码登录