c++ - 在 Windows 构建中使用 pthread.h

标签 c++ c pthreads

我有一个广泛使用 pthread.h 的代码库。在 windows visual studio 项目中,这显然行不通,因为 pthreads 是一个 unix 实用程序。

我知道存在 pthread-win32 或类似的东西,但是有没有办法让代码库使用它,而不用替换所有 pthread 代码?

编辑:我宁愿不必遍历并替换所有 pthread 调用。这是我的问题

最佳答案

尝试 http://sourceware.org/pthreads-win32/ .虽然我从未使用过那个特定的库,但我很幸运地使用了 POSIX API 的一些 Windows 端口/抽象层。

关于c++ - 在 Windows 构建中使用 pthread.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4170038/

相关文章:

c++ - 在跨线程读取无符号整数时,c++位是否自动切换?

c++ - 从第三方类实现虚函数

c++ - Clang 输出错误 "no matching construct for initialization"

c++ - 如何初始化常量字符串集

c - 标准 C 函数在第一次调用时速度较慢,如何正确解决这个问题?

c - 将 Unix 移植到 Windows - pwd.h 的使用

linux - 如何从用户空间访问thread_info

c - Pthread Xlib编程

c - 将 malloc 与 char 指针一起使用时出现段错误

c - 段错误或 SizeOf 未正确使用