标签:
--------------------------------------
fork - create a child process
#include <unistd.h>
pid_t fork(void);
exec系列。
int pthread_create(pthread_t *restrict tidp,const pthread_attr_t *restrict_attr,void*(*start_rtn)(void*),void *restrict arg);
--------------------------------------
exit - cause normal process termination
#include <stdlib.h>
void exit(int status);
atexit - register a function to be called at normal process termination
#include <stdlib.h>
int atexit(void (*function)(void));
1 函数返回
2 进程终止
3 void pthread_exit(void *retval)
--------------------------------------
pid_t waitpid(pid_t pid, int *status, int options);
pthread_join(pthid,int *status);
pthread_detach(pthread_self());
--------------------------------------
getpid();
pthread_self();
--------------------------------------
pid_t
pthread_t
--------------------------------------
pthread_mutex_t
pthread_mutex_lock(&pthread_mutex_t)
pthread_mutex_unlock(&pthread_mutex_t)
pthread_cond_t INITIALIZER
pthread_cond_signal(&pthread_cond_t)
pthread_cond_wait(&pthread_cond_t,&pthread_mutex_t )
pthread_cond_broadcast
pthread_cond_timewait
pthread_key_t
pthread_once_t
pthread_key_create(&key,destory)
//一个进程对应128个key结构,这里返回的key就是一个数组下标
pthread_setspecific(key, void *)
void * pthread_getspecific(key)
pthread_once(&pthread_once_t, func)
--------------------------------------
线程共享
1 打开的文件描述符(不增加文件描述符的引用计数)
2 信号处理函数和信号处置
3 大多数数据(全局变量)
标签:
原文地址:http://www.cnblogs.com/lijinping/p/5879624.html