摘要: #include <pthread.h>int pthread_detach(pthread_t tid); pthread_t tid: 分离线程的tid返回值:成功返回0,失败返回错误号。 一般情况下,线程终止后,其终止状态一直保留到其它线程调用pthread_join获取它的状态为止。但是线程 阅读全文
posted @ 2018-01-10 14:35 夜行过客 阅读(2189) 评论(0) 推荐(0) 编辑
摘要: 获取调用线程tid #include <pthread.h>pthread_t pthread_self(void); 示例: 运行结果: main thread: pid 4959 tid 9791296 (0x956740)new thread: pid 4959 tid 1480448 (0x 阅读全文
posted @ 2018-01-10 14:05 夜行过客 阅读(10145) 评论(0) 推荐(0) 编辑
摘要: 一. pthread_create() #include <pthread.h> int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg) 阅读全文
posted @ 2018-01-10 11:27 夜行过客 阅读(3578) 评论(0) 推荐(0) 编辑