码迷,mamicode.com
首页 > 系统相关 > 详细

advanced linux programming note

时间:2014-07-18 00:19:54      阅读:317      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   color   strong   os   

1.pthread_create function creates thread that share the same memory with the process.

2.pthread_join function wait for threads until they stop

3.The pthread_self function returns the thread ID of the thread in which it is
called;This thread ID may be compared with another thread ID using the
pthread_equal function

1 if (!pthread_equal (pthread_self (), other_thread))
2     pthread_join (other_thread, NULL);

4.one of thread‘s important attribute is the detach state,which includes joinable state(default) and detached thread.the difference is that the joinable thread is not automatically cleaned up by GNU/Linux when it terminates,but needs pthread_join to do the clean up.A detached thread is just the opposite.

Even if a thread is created in a joinable state, it may later be turned into a detached thread.To do this, call pthread_detach . Once a thread is detached, it cannot be made joinable again.

advanced linux programming note,布布扣,bubuko.com

advanced linux programming note

标签:des   style   blog   color   strong   os   

原文地址:http://www.cnblogs.com/idiotshi/p/3851261.html

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