首页 > 系统服务 > 详细

advanced linux programming note

时间:2014-07-18 00:01:40      阅读:412      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!