码迷,mamicode.com
首页 > 其他好文 > 详细

pthread

时间:2017-04-17 20:03:48      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:des   mask   creat   ret   信号量   color   posix   xxxx   取消   

 1 线程
 2     先有标准,后有实现    
 3     POSIX标准
 4     pthread_xxxx();
 5 
 6 一、线程及标识
 7     运行的函数
 8     pthread_t ----> 不能打印
 9 
10     pthread_self(3);
11     pthread_equal(3);
12 
13 ps axm -L
14 
15 二、线程的创建
16     pthread_create(3);
17 
18 三、线程的终止
19     <1>return
20     <2>pthread_exit();
21     <3>被cancel
22     <4>任意一个线程调用exit(3),或者main()return(整个进程终止)
23 
24 四、线程的收尸
25     pthread_join(3);
26 
27 五、线程的取消
28     pthread_cancel();
29     pthread_testcancel();
30 
31 取消点
32     man 7 pthreads    
33 
34 六、线程的同步
35     互斥量
36     pthread_mutex_t
37     pthread_mutex_init();
38     pthread_mutex_lock();
39     pthread_mutex_unlock();
40     pthread_mutex_destroy();
41 
42     条件变量
43     pthread_cond_t
44     pthread_cond_init();
45     pthread_cond_wait();
46     pthread_cond_signal();
47     pthread_cond_broadcast();
48     pthread_cond_destroy();    
49     
50 
51 七、线程的分离
52     pthread_attr_init();
53     pthread_attr_setdetachstate();
54 
55     pthread_detach();        
56 
57 八、线程和信号、进程、io
58     pthread_kill();
59     pthread_sigmask();
60     sigwait();
61 
62     pread(2);
63     pwrite(2);    
64 
65 信号量
66                                     

 

pthread

标签:des   mask   creat   ret   信号量   color   posix   xxxx   取消   

原文地址:http://www.cnblogs.com/axjlxy/p/6724372.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!