简体   繁体   English

我应该在Linux上使用哪个线程库用于多线程C程序?

[英]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.hpthread.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.

相关问题 修改C消息队列程序以在Linux中使用 - Modifying C message queue programs for use in Linux 我可以将Thread Sanitizer用于OpenMP程序吗? - Can I use Thread Sanitizer for OpenMP programs? 如何以及何时在C程序中使用_POSIX_C_SOURCE? - How and when should I use _POSIX_C_SOURCE in C programs? 在C / C ++中使用rand_r进行多线程程序的正确方法 - Correct way to use rand_r for multithreaded programs in C/C++ 我应该去哪个Linux发行版学习Linux中的C / C ++ / Assembly - Which Linux distribution should I go for learning C/C++/Assembly in Linux 我应该使用哪种:C99的complex.h库或“复杂数字类型的GNU扩展”? - Which should I use: C99's complex.h library or the “GNU Extensions for Complex Number Types”? 为什么需要在多线程程序中使用Pthread_sigmask来确保set处理程序正在处理信号? - Why do I need to use Pthread_sigmask in multithreaded programs to assure that a signal is being handled by the set handler? 与库链接的C程序 - C programs linked with library 如何在Linux上的C库中使用编译的二进制文件? - How do I use a compiled binary for a C library on Linux? 我在哪里放置可以在Windows,Mac和Linux上使用的C库 - Where do I place a C library for use on Windows, Mac, and Linux
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM