Thread API函数使用:
thread_create(), thread_join(), thread_exit().
代码实例中涉及到线程的创建,传参和返回值,返回值的接受。
参考:《POSIX多线程程序设计中文版》中2.1 建立和使用线程 。
实例代码:
//thread_create(), thread_join(), thread_exit()
#include <pthread.h>
#include <stdio.h>
//#include <iostream>
//using namespace std;
void* thread_one(void* arg)
{
int *iarg = (int*)arg;
//cout << "thread_two " << *iarg << endl;
printf("thread_one