您的位置:首页 > 其它

pthread_create的用法

2007-02-12 13:39 288 查看
由于pthread库不是Linux系统默认的库,所以在使用pthread_create创建线程时,在编译中请加-lpthread参数,例如:

#include "pthread.h"

#include "stdio.h"

void* thread_test(void* ptr)

{

printf("test");

}

int main()

{

pthread_t pid;

pthread_create(&pid, NULL, test_thread, NULL);

return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: