Netbeans 中的 C pthread_barriers (cygwin)

标签 c netbeans cygwin pthreads barrier

我想在 netbeans 中编写一些学校的 C 任务。他们给了我们必须使用 pthread_barrier 的任务。所以我下载了netbeans和cygwin以及gcc、g++、gdb和make。在pthreads.h中没有任何pthread_barrier_t等。在this question中我发现“障碍是在 POSIX 1003.1 2004 版的可选部分中定义的”。问题是如何在 cygwin 中使用 netbeans 中的屏障?

一些代码:

//#define _POSIX_BARRIERS 1 
//I don't get it what they mean 
//"only if the _POSIX_BARRIERS macro is defined as positive number,
//you can use pthread_barrier_t"

#define _XOPEN_SOURCE 600

#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <semaphore.h>

// declaration of the barrier
pthread_barrier_t a_barrier; // err: Unable to resolve identifier pthread_barrier_t.

最佳答案

Cygwin 目前不支持 pthread_barrier_*,因此您将无法在 Cygwin 上编译或运行需要这些功能的代码。

关于Netbeans 中的 C pthread_barriers (cygwin),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27650215/

相关文章:

c++ - 用于查看 Wireshark 重置数据包的 C/C++ 应用程序

java - 用户输入的二次公式 (Java)

windows - 在特定文件夹中打开 Cygwin

gcc - Cygwin 上的 C 编译器生成什么?

java - 在 Cygwin 上运行 Java 程序 - 找不到类路径

c - 在代码中出现运行时错误

c - 当不在 main 内部工作时

c - "%"符号后面的数字有什么作用?

netbeans - 如何在netbeans中调试JBOSS应用程序?

java - 我可以将 Java Swing 应用程序部署为 Glassfish 中的企业应用程序吗