[英]Which thread library should I use for multithreaded C programs on Linux?
I've done threads in Java, but I'm a complete noob to threads in C. My first question, after googling some, is: Which thread library do I use? 我已经用Java完成了线程,但我是C中线程的完整菜鸟。我的第一个问题,在谷歌搜索之后,是:我使用哪个线程库? Does it matter?
有关系吗? It seems I have
thread.h
and pthread.h
to choose from. 看来我有
thread.h
和pthread.h
可供选择。
OS is, and will be, Linux. 操作系统是Linux,也将是Linux。 More specifically, it's Ubuntu at the moment and will either stay like that, or become RHEL.
更具体地说,它现在是Ubuntu,并将保持这样,或成为RHEL。 But I guess the distro doesn't matter?
但是我觉得发行版没关系?
The POSIX thread libraries ( pthread.h
) are a standards based thread API for C/C++ and is what I would use. POSIX线程库(
pthread.h
)是用于C / C ++的基于标准的线程API,我将使用它。 There are also several tutorials available such as this one or this one . 还有一些可用的教程,例如本教程或本教程。
I will admit that I am not familiar with thread.h
. 我承认我对
thread.h
不熟悉。
POSIX系统(如linux)上的标准线程接口是pthread,用于POSIX线程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.