C++多线程----pthread实现篇
头文件
在linux下通常使用的多线程库是pthread库,库函数中包含了线程和进程的实现,线程与进程的关系。可以参考我转载的文章进程、线程以及CPU调度,或看另一片文章C++中的多线程—介绍篇去了解更多线程与进程的基础知识。
在使用在linux下开发多线程需要头文件
#include <pthread.h>
创建线程函数:pthread_create()
创建一个线程的原型函数如下所示,如果创建成功返回0
extern int pthread_create __P ((pthread_t *__thread,__const pthread_attr_t