今天在新安装的 fedora 17 虚拟机上写多线程程序的时候,本想查看下系统帮助手册中关于线程相关函数的说明,结果。。。
为啥呢?
在以下网页上找到了答案: http://blog.163.com/yungang_z/blog/static/1751531332011103103529810/
于是操作如下(安装手册):
[tom@localhost thread]$ man pthread_create
No manual entry for pthread_create
为啥呢?
在以下网页上找到了答案: http://blog.163.com/yungang_z/blog/static/1751531332011103103529810/
于是操作如下(安装手册):
[tom@localhost thread]$
yum install man-pages -y
Loaded plugins: langpacks, presto, refresh-packagekit
You need to be root to perform this command.
[tom@localhost thread]$ sudo yum install man-pages -y
Loaded plugins: langpacks, presto, refresh-packagekit
Existing lock /var/run/yum.pid: another copy is running as pid 6661.
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: PackageKit
Memory : 26 M RSS (431 MB VSZ)
Started: Sun Dec 16 17:57:33 2012 - 00:32 ago
State : Sleeping, pid: 6661
[tom@localhost ~]$ ps -ef | grep package
root 6656 1 0 17:57 ? 00:00:00 /usr/libexec/packagekitd
tom 6744 6686 0 17:59 pts/0 00:00:00 grep --color=auto package
[tom@localhost ~]$ kill 6656
[tom@localhost ~]$ sudo kill 6656
[sudo] password for tom:
[tom@localhost ~]$ ps -ef | grep package
tom 6780 6686 0 18:01 pts/0 00:00:00 grep --color=auto package
一旦该进程被 kill 成功之后,手册安装就能成功进行了:
Resolving Dependencies
--> Running transaction check
---> Package man-pages.noarch 0:3.35-4.fc17 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Installing:
man-pages noarch 3.35-4.fc17 updates 4.9 M
Transaction Summary
=============================================================================================================================================================
Install 1 Package
Total download size: 4.9 M
Installed size: 4.4 M
Downloading Packages:
http://mirrors.ustc.edu.cn/fedora/linux/updates/17/x86_64/man-pages-3.35-4.fc17.noarch.rpm: [Errno 12] Timeout on
http://mirrors.ustc.edu.cn/fedora/linux/updates/17/x86_64/man-pages-3.35-4.fc17.noarch.rpm: (28, '')
Trying other mirror.
man-pages-3.35-4.fc17.noarch.rpm | 4.9 MB 00:41
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : man-pages-3.35-4.fc17.noarch 1/1
Verifying : man-pages-3.35-4.fc17.noarch 1/1
Installed:
man-pages.noarch 0:3.35-4.fc17
再查一下相关函数的帮助,就 ok 了:
[tom@localhost thread]$ man pthread_create
PTHREAD_CREATE(3) Linux Programmer's Manual PTHREAD_CREATE(3)
NAME
pthread_create - create a new thread
SYNOPSIS
#include <pthread.h>
int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
void *(*start_routine) (void *), void *arg);
Compile and link with -pthread.
DESCRIPTION
The pthread_create() function starts a new thread in the calling process. The new thread starts execution by invoking start_routine(); arg is
passed as the sole argument of start_routine().