2

我想在 netbeans 中编写一些学校的 C 任务。他们给了我们必须使用 pthread_barrier 的任务。所以我用 gcc、g++、gdb 和 make 下载了 netbeans 和 cygwin。In pthreads.his not any pthread_barrier_tetc. 在这个问题中,我发现“障碍是在 POSIX 1003.1 2004 版的可选部分中定义的”。Qustion 是如何在 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.
4

1 回答 1

2

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

于 2014-12-25T23:59:45.150 回答