Linux 线程

1. 在Linux上获得线程id

#define gettid() syscall(__NR_gettid)

用到的地方 gettid()

2. 查找进程ID

ps -ef | grep 进程name

3. 显示特定进程的线程

ls  /proc/进程ID/task

4. 当用pthread_creat创建线程时, 当线程函数执行完,线程会自行消亡  (Uncertain)

5. 编译 多线程 程序 gcc -g -o test test.c -lpthread              test 是文件名

Advertisements
This entry was posted in Linux. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s