Linux PThread 库的源代码?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3224252/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 20:14:55  来源:igfitidea点击:

Source code of PThread Library?

linuxpthreadsopen-source

提问by bits

I am trying to find the source code of pthread library. (I guess its a supposed to be a part of Linux source code)

我正在尝试查找 pthread 库的源代码。(我猜它应该是Linux源代码的一部分)

But somehow can't find any good website that has it.

但不知何故找不到任何好的网站。

I like this website: http://lxr.linux.no/#linux+v2.6.34.1/where I usually find what I need. Somehow pthread source is not searchable. Anyway, I wanted to mention that I need a link to a browsable (and searchable) website like that one.

我喜欢这个网站:http: //lxr.linux.no/#linux+v2.6.34.1/在这里我通常可以找到我需要的东西。不知何故,pthread 源无法搜索。无论如何,我想提一下,我需要一个链接到一个可浏览(和可搜索)的网站。

Websites for browsing linux source can be a matter of personal taste. So all links to the pthread source are welcome.

浏览 linux 源代码的网站可能是个人喜好的问题。因此,欢迎所有指向 pthread 源的链接。

Most probably I will end up bookmarking all of them, look thru them, and then accept the best answer.

很可能我最终会将所有这些都加入书签,浏览它们,然后接受最佳答案。

回答by Dirk Eddelbuettel

Did you look at GNU libc?

你看过 GNU libc 吗?

On my Debian box, I see

在我的 Debian 机器上,我看到

edd@mccoy:~$ dpkg -S /usr/lib/libpthread.so 
libc6-dev: /usr/lib/libpthread.so
edd@mccoy:~$ apt-cache show libc6-dev
Package: libc6-dev
Priority: optional
Section: libdevel
Installed-Size: 13172
Maintainer: GNU Libc Maintainers <[email protected]>
Architecture: i386
Source: glibc
Version: 2.7-18lenny4
Replaces: man-db (<= 2.3.10-41), gettext (<= 0.10.26-1), ppp (<= 2.2.0f-24), 
          libgdbmg1-dev (<= 1.7.3-24)
Provides: libc-dev
Depends: libc6 (= 2.7-18lenny4), linux-libc-dev
Recommends: gcc | c-compiler
Suggests: glibc-doc, manpages-dev
Conflicts: libstdc++2.10-dev (<< 1:2.95.2-15), gcc-2.95 (<< 1:2.95.3-9), 
           binutils (<< 2.17cvs20070426-1), libc-dev
Filename: pool/updates/main/g/glibc/libc6-dev_2.7-18lenny4_i386.deb
Size: 3387248
MD5sum: 9cdb8401cead8afdd9f3e5da7bf673f8
SHA1: 01049f981a24dc0e5da8a3a1e57a8f2e91d7e57a
SHA256: 89c222ece39c417ee91f24d9f5619f58be330b111092379e4f09b93bcbfe834b
Description: GNU C Library: Development Libraries and Header Files
 Contains the symlinks, headers, and object files needed to compile
 and link programs which use the standard C library.
Build-Essential: yes
Tag: devel::lang:c, devel::library, implemented-in::c, role::devel-lib, suite::gnu

edd@mccoy:~$ 

回答by caf

pthreads are implemented on Linux in libc. The usual libc is glibc- the glibc pthreads implementation is called NPTL, and the source is available in gitweb.

pthreads 在 Linux 上以libc. 通常的 libc 是glibc- glibc pthreads 实现称为 NPTL,源代码在 gitweb 中可用