advanced linux programming note

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

时间: 2024-08-29 06:12:44

advanced linux programming note的相关文章

QT开发--《Beginning Linux Programming》4th Edition

最近在学习<Beginning Linux Programming>4th Edition的时候,将下面的例子代码键入 #include<qapplication.h> #include<qmainwindow.h> int main(int argc,char* args[]) { QApplication app(argc,args); QMainWindow *window=new QMainWindow(); app.setMainWidget(window);

Kali linux learning note

from:http://blog.sina.com.cn/s/blog_40983e5e0101dhz0.html 因为kali linux基于debian 7,当然要把这台Acer 4736z原有的debian 7删掉装kali啦,哈哈,这下不必为了BT5装虚拟机了,对于本子里60G的SSD来说还是好事一桩.要把kali当做桌面使用,就必须给kali添加一些软件,修改一些设置才好用,下面记录一下备忘,随时更新. 安装方法,官方文档,硬盘安装Kali Linux 把apt源设为官方提供的国内镜像

Linux System Programming note 8 ——File and Directory Management

1. The Stat Family #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> int stat(const char *path, struct stat *buf); int fstat(int fd, struct stat *buf); int lstat(const char *path, struct stat *buf); struct stat{ dev_t st_d

Get your Advanced Java Programming Degree with these Tutorials and Courses

Getting started as a Java developer these days is quite straightforward. There are countless books on the subject, and of course an abundance of online material to study. 最近,入门成为一名java开发人员是非常简单的.有无相关的书籍,当然还有大量的在线资料可供学习 Of course, our own site offers

Linux Kernel: note

1. Each process in Linux has two stacks, a user stack and a kernel stack (8KB by default) 2.  thread_info is architecure dependent but task_struct is generic 3. fork call chain: libc fork() system_call (arch/i386/kernel/entry.S) sys_clone() (arch/i38

Linux Programming

You can use the cat command to see the content of a file and display the line numbers by using the -b option along with the cat command as follows cat -b filename You can use the wc command to get a count of the total number of lines, words, and char

Introduce to Java Programming:NOTE

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default"></script> 博客中要分别讨论的java专题: Calendar类 File类 Number类 测试文章的方式来看 计算机中字节(byte)是最小的存储单元,1byte=8bits. 内存:随机访问存储器(RAM).内存中每一个字节都有其

我的Linux书架

原文地址www.cnblogs.com/wwang/archive/2011/01/27/1944406.html 工作几年来,一直从事Linux内核驱动方面的开发.从接触Linux到现在,读过不少Linux方面的书籍,现把认为很不错的一部分列出来和大家分享一下. 入门类 一直认为,在一个系统上学习开发之前,首先需要熟悉这个系统的使用.鉴于天朝的国情,绝大部分人第一个接触的操作系统就是Windows,因此对于这绝大部分人来说,如果要学习Linux开发,学会使用这个系统都是必不可少的一个环节. 现

Linux/Unix 新手和专家教程

你正在找一些高质量的Linux 和 UNIX 的教程吗?如果是,这篇文章会告诉你到哪去找到这些教程.这里我们将给出超过30个相当的不错的 Linux 和 UNIX 在线的教程. 需要大家注意的是,他们都是英文的,也许有一些也经被翻译到了中文社区,你可以搜索一下.但不管怎么样,我的建议是应该尽可能的去阅读英文. Linux 和UNIX 的新手培训教程 免费的新手Linux教程 Introduction to Linux – 这是来自IBM的教程,用于给那些想学习Linux的人. Linux Des